Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Persistence API

Tags:

java

jpa

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.

like image 811
Yatendra Avatar asked Apr 01 '10 12:04

Yatendra


1 Answers

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
like image 144
Pascal Thivent Avatar answered Oct 11 '22 01:10

Pascal Thivent