16

How to understand What JPA version I'm using in EJB? Is JPA built-in EJB?

Regards

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
Nav
  • 4,450
  • 10
  • 53
  • 84

2 Answers2

17

With a Java EE 5 container, you get JPA 1.0 (specified in the JSR 220 - Enterprise JavaBeans, Version 3.0).

With a Java EE 6 container, you get JPA 2.0 (specified in the JSR 317: Java Persistence 2.0 which is now dedicated).

And if you are providing your own JPA implementation, well, it depends on the implementation and the version you provide :)

Here are some JPA 2.0 implementations and their respective versions:

  • EclipseLink 2.0+
  • Hibernate EntityManager 3.5+
  • OpenJPA 2.0+
  • DataNucleus 2.1.0+
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • How can I find this standalone specification in JEE6? – Nav Aug 19 '10 at 10:10
  • @Navid I'm not sure this is what you're looking for but I added some links to the specs. – Pascal Thivent Aug 19 '10 at 10:19
  • Are Persistence Providers implementing JPA? if yes, so I can not use just JPA because it is just API, isn't it? and I have to use one of JPA 2.0 implementations ? – Nav Aug 19 '10 at 10:20
  • @Navid: Yes, persistence providers are providing JPA implementations. And yes, JPA is indeed just an API (like the whole Java EE platform) and you have to use an implementation. – Pascal Thivent Aug 19 '10 at 10:31
  • Tahnks for you answer, but would you please tell me the version of JDK in difference with JEE? or there is a relation between them? – Nav Aug 19 '10 at 10:37
  • @Navid: Sure, see [Correlation between JEE / J2EE to J2SE / JDK versions](http://stackoverflow.com/questions/2013958/correlation-between-jee-j2ee-to-j2se-jdk-versions/2015780#2015780). – Pascal Thivent Aug 19 '10 at 10:39
0

No JPA and EJBs are not related at all, they are totally independent. JPA is not built in EJBs. The javaee-api 6 which is the JAVA EE 6 container gives you the code for EJB 3 and JPA 2.+. In order to implement EJB3 you can use weblogic or JBoss or any application container. To implement JPA you can use hibernate, OpenJPA etc.

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
</dependency>