Hibernate JPA 2.1 dependency

10,178

Solution 1

hibernate-core dependency

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>4.3.9.Final</version>
</dependency>

includes:

<dependency>
  <groupId>org.hibernate.javax.persistence</groupId>
  <artifactId>hibernate-jpa-2.1-api</artifactId>
  <version>1.0.0.Final</version>
  <scope>compile</scope>
</dependency>

Solution 2

You need to run mvn dependency:tree and find which dependency is bringing you the hibernate-jpa-2.0-api-1.0.1.Final.jar artifact.

Afterward, you need to exclude this transitive dependency.

Share:
10,178
fiddle
Author by

fiddle

Updated on June 13, 2022

Comments

  • fiddle
    fiddle almost 2 years

    I am getting 2 jars for Hibernate JPA:

    • hibernate-jpa-2.0-api-1.0.1.Final.jar
    • hibernate-jpa-2.1-api-1.0.1.Final.jar

    What should I do to fix this? I just want:

    hibernate-jpa-2.1-api-1.0.1.Final.jar
    

    I have the below in POM :

    <!-- Hibernate -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
    </dependency>
    
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
    </dependency>