JPA 2.0 API maven artifact
I am currently using the Hibernate JPA 2.0 artifact, but I'd like to use something more standard
There is still no javax.persistence:persistence-api:jar:2.0
artifact from Sun/Oracle. Either use the full javax:javaee-api:jar:6.0
artifact if you want something from Sun/Oracle... or just stick with the interfaces provided by Hibernate, EclipseLink, OpenJPA, etc.
Currently (Q1 2020) the default artifact is
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>2.2.3</version>
</dependency>
An older artifact of javax.persistence-api
is also available at maven central, but is superseded by the jakarta version.
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
The code is maintained in this github repo.
As Ivan explains, there are no official Sunacle jars in Maven. However, it is quite often the case that an implementer of a given API will publish an artifact for that API (the API itself, rather than their implementation of it.
In the case of JPA 2.0, Hibernate publish org.hibernate.javax.persistence:hibernate-jpa-2.0-api, which contains just the javax.persistence
classes, and no Hibernate-specific stuff.
My build.gradle therefore says:
dependencies {
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.0-api', version: '1.0.1.Final'
runtime group: 'org.hibernate', name: 'hibernate-entitymanager', version: '4.1.4.Final'
}
Which puts Hibernate's release of the API on the compile classpath, and their implementation on the runtime classpath.