我使用JPA,Hibernate作为其实现。我需要哪些maven2
依赖项才能在我的项目中使用
答案 0 :(得分:3)
我相信你需要的只有两件事是hibernate的entitymanager,然后是一个SLF4J日志包。其他所有内容都应该作为依赖项引入:
<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>
答案 1 :(得分:0)
这是我正在使用的。您可能会也可能不想遵守除外条款;它们对我有意义,因为JTA和JPA已经包含在我在其他地方提供的完整Java EE API中。如果你不使用Commons Logging,你可能想选择一个不同的slf4j实现。
<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>