I use JPA, and Hibernate as its implementation. What maven2
dependencies I need to have in my project?
views:
34answers:
2
+2
A:
I believe the only two things you need are hibernate's entitymanager and then one of the SLF4J logging bundles. Everything else should be pulled in as dependencies:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.1-Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<!-- version 1.5.8 is the latest version that will work with the slf4j-api
that's currently bundled with hibernate-parent -->
<version>1.5.8</version>
</dependency>
Kaleb Pederson
2010-09-28 16:25:43
A:
Here's what I'm using. You may or may not want to keep the exclusion clauses; they make sense for me, since JTA and JPA are already included in the full Java EE APIs which I'm providing elsewhere. And if you're not using Commons Logging, you might want to pick a different slf4j implementation.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.5.3-Final</version>
<exclusions>
<exclusion>
<artifactId>jta</artifactId>
<groupId>javax.transaction</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.3-Final</version>
<exclusions>
<exclusion>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<groupId>org.hibernate.javax.persistence</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- match version to the slf4j-api that's required by Hibernate -->
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>1.5.8</version>
</dependency>
Mike Baranczak
2010-09-28 16:26:04