6

I am new to Java Persistence API. I have just learnt it and now want to use it in my Java Desktop Application. But I have the following questions regarding it:

Q1. Which JPA implementation is smallest in size (as I want to have my application's size as small as possible)?

Q2. How to find the value of the <provider> tag in the persistence.xml file. I know that its value is vendor specific but I couldn't find the value for the JPA implementation downloaded from here.

1
  • 1
    That being referred to is NOT an implementation of JPA. It's simply the JPA API jar (of interfaces) and is required by all implementations. Commented Apr 1, 2010 at 15:16

3 Answers 3

5

Q1. Which JPA implementation is smallest in size (as I want to have my application's size as small as possible)?

For JPA 1.0:

  • Hibernate Entity Manager 3.4.0.GA: ~4.9MB
  • EclipseLink 1.1.3: ~4.7MB
  • OpenJPA 1.2.2: ~2.7MB (I'm not sure for this one, not tested for now so I may be missing some jars)

I would stay away from TopLink Essentials.

For JPA 2.0:

  • DataNucleus 2.0.3: ~3.7MB
  • EclipseLink 1.2 and 2.0+: ~4.8MB
  • Hibernate Entity Manager 3.5.0-Final: ~5.8MB
  • OpenJPA 2.0.0-beta3: not measured (still in beta)

These measures have been done on my pet project (including dependencies except the JDBC driver). Personally, I wouldn't base my choice on the size only, even for a desktop app.

Q2. How to find the value of the tag in the persistence.xml file.

  • DataNucleus: org.datanucleus.jpa.PersistenceProviderImpl
  • EclipseLink: org.eclipse.persistence.jpa.PersistenceProvider
  • Hibernate: org.hibernate.ejb.HibernatePersistence
  • OpenJPA: org.apache.openjpa.persistence.PersistenceProviderImpl
  • TopLink Essentials: oracle.toplink.essentials.PersistenceProvider
Sign up to request clarification or add additional context in comments.

4 Comments

Ok... which implementation would you choose regardless of the size?
I was about to go with TopLink Essentials. Why would you stay away from that?
@Yatendra Because nothing happens with Toplink Essentials (it's maintained but dead), because it requires weaving, because you need to use a javaagent, because I've always found it painful to use (might not be that painful with 5 entities though). But it works.
@Yatendra I like Hibernate which is widely used, tested, supported and this matters to me. But, again, this might not be that critical for a five tables application. Maybe you should implement your app and test it with various JPA providers.
2

Q1. VERY rough calculated:

  • Hibernate (versions around 3.4.0.GA) with deps is ca. 3.6 Mb.
  • TopLink Essentials (2.0.1-04) ca. 2.4 Mb.
  • EclipseLink (ex. TopLink) (1.1.3-M1) ca. 4.7 Mb.

Q2. Open the JAR, check the META-INF/services/javax.persistence.spi.PersistenceProvider file.

3 Comments

The JPA imlementation (glassfish-persistence-api-b32g) whose link I have provided in my question has just 50KB size. But it hasn't any services folder in META-INF folder.
It's API, not implementation. As far as I know, GlassFish uses EclipseLink as RI.
@BalusC Would you like to comment on <a href="http://findjar.com/jar/net/java/dev/glassfish/glassfish-persistence-api/b32g/glassfish-persistence-api-b32g.jar.html">glassfish-persistence-api-b32g</a> JPA implementation. I have been attracted towards it due to its lowest size (50KB).
0

You mean size in memory ? or size of jar ? Size in memory depends on how many classes are being persisted, the metadata for them, how many EntityManagers open, what is in the L1/L2 caches. I know that DataNucleus uses less memory than Hibernate since users themselves have reported that, no idea against the other primary implementations.

Size of a jar is a pointless measure of anything, since the majority of things there may not be in use.

PS. DataNucleus is also a JPA1+2 implementation

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.