JPA/EJB3 Relationship
Asked Answered
M

3

12

I have been reading about JPA and EJB3 and would like to confirm that my understanding of their relationship is correct. Here's what I think I know...

JPA is a specification that has been implemented by a number of vendors including:

  • JBoss/Hibernate
  • Oracle/TopLink Essentials (now EclipseLink)
  • Apache/OpenJPA

EJB3 is a specification that is implemented in Application Servers including:

  • Glassfish
  • JBoss

Is this correct?

Mitchellmitchem answered 18/5, 2010 at 16:27 Comment(0)
I
22

The Java Persistence API introduced in Java EE 5 is a subset of EJB 3 and replaces the persistence solution of EJB 2.0 CMP. JPA 1.0 has been defined as part of the EJB 3.0 specification (JSR 220) but can be used without and outside an EJB container. In Java EE 6, JPA 2.0 has its separate specification (JSR 317), outside the EJB 3.1 specification (JSR 318). So to summarize:

  • JPA is a subset of EJB 3 and implementations are provided by persistence providers like Toplink Essentials / EclipseLink, Hibernate, Kodo / OpenJPA (Kodo is the project from which the OpenJPA source code was derived and Kodo is now, in turn, based on OpenJPA), etc.

  • EJB 3 is a wider specification and implementations are provided by the EJB container of application servers that rely on persistence providers:

    • The default persistence provider of GlassFish v3 is EclipseLink
    • The default persistence provider of JBoss is Hibernate
    • The default persistence provider of WebLogic 10.3.1+ is OpenJPA/Kodo or EclipseLink
    • The default persistence provider of WebSphere 6.1+ is (based on) OpenJPA
Ironsides answered 18/5, 2010 at 17:53 Comment(3)
JPA being a subset of EJB3 makes sense out of why I have seen so many references where the terms are used interchangeably and the main cause of me going in circles as I tried to understand them. Thanks!Mitchellmitchem
@Mitchellmitchem You're welcome. This is simplified but EJB3 has Session Beans, Entity Beans and Message Driven Beans. JPA is the Entity Beans part.Ironsides
Also worth mentioning is that EclipseLink is the official reference implementation for JPA 2.0.Belch
C
0

Yes, and JPA1 and JPA2 is also implemented by DataNucleus which also implements JDO1, JDO2, JDO3, as well as the OGC Simple Feature spec; and is also the only truly independent implementation (not tied to a large software vendor). Obviously, users are free to slot in whichever JPA implementation they wish into their EJB3 environment

Carving answered 18/5, 2010 at 17:2 Comment(0)
H
0

Yes, I had too google OpenJPA but this is correct

Holle answered 18/5, 2010 at 17:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.