The Eclipselink and JPA API need to be included. Example Maven dependencies:
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.1</version>
</dependency>
<!-- ... -->
</dependencies>
Hibernate-core is required. Example Maven dependency:
<dependencies>
<dependency>
<!-- requires Java8! -->
<!-- as of 5.2, hibernate-entitymanager is merged into hibernate-core -->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0</version>
</dependency>
<!-- ... -->
</dependencies>
datanucleus-core, datanucleus-api-jpa and datanucleus-rdbms (when using RDBMS datastores) are required. Example Maven dependency:
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>5.0.0-release</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>5.0.0-release</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>5.0.0-release</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.2</version>
</dependency>
<!-- ... -->
</dependencies>
JPA requires the use of a file persistence.xml, located under META-INF
from the root of the CLASSPATH. This file contains a definition of the available persistence units from which JPA can operate.
JPA additionally allows use of a mapping configuration file orm.xml, also placed under META-INF
. This mapping file is used to configure how classes are mapped to the datastore, and is an alternative/supplement to use of Java annotations in the JPA entity classes themselves.