The Java Persistence API (JPA) is a Java specification for accessing, persisting, and managing data between
Java objects / classes and a relational database.
JPA (Java Persistence API) is an interface for persistence providers to implement.
Hibernate is one such implementation of JPA.
When you use Hibernate with JPA you are actually using the Hibernate JPA implementation.
JPA typically defines the metadata via annotations in the Java class. Alternatively via XML or a combination of both. A XML configuration overwrites the annotations.
Hibernate:The most advanced and widely used. Pay attention for the classpath because a lot of libraries are used, especially when using JBoss. Supports JPA 2.1.
Toplink: Only supports the basic JPA specs. (This was oracle’s free version of the JPA implementation)
EclipseLink: Is based on TopLink, and is the intended path forward for persistence for Oracle and TopLink. Supports JPA 2.1
Apache OpenJPA: Best documentation but seems very buggy. Open source implementation for JPA. Supports JPA 2.0
DataNucleus: Well documented, open source (Apache 2 license), is also a JDO provider. Supports JPA 2.1
ObjectDB: well documented
Other approaches are:
ORM with Hibernate: Hibernate is now also very supportive for JPA
iBatis: The project moved to MyBatis
Motivation for Hibernate as JPA choice:
Useful Hibernate sub projects
- Most advanced
- Well documented
- Hibernate tools: automatic generation of code and database generation
- Hibernate validation: bean specification capabilities. Integrates with JPA2
- Hibernate search: powerful full-text search on domain objects
- Big development community
- Widely used