Reputation: 151
As far as I know JPA 2.0 has been approved as final in December 2009.
But the central repository gives the pom file declaration for 1.0.2 and 3.0-public_review.
So how can I use the current version of JPA 2.x using maven?
Upvotes: 1
Views: 93
Reputation: 7161
JPA itself is just the API definition, you'll need a provider who has implemented the API. I tend to use hibernate but there are others such as EclipseLink or OpenJPA. If you stick to just the core JPA functionality then you'll be able to swap providers at a later date easily enough.
Your choice of provider may be influenced if you're using a particular EE application server. JPA is part of the EE spec now but each server uses a different provider. E.G. JBoss uses hibernate while glassfish uses EclipseLink I believe.
With that in mind this is how I declare my hibernate dependency in my pom.xml.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.8.Final</version>
</dependency>
This will automatically pull in the JPA 2.0 API jar along with other dependencies such as validation.
Upvotes: 1