What dependencies should my project have if I use JPA in Hibernate?

I use JPA and Hibernate as its implementation. What maven2dependencies do I need for my project?

+3
source share
2 answers

I believe that only two things you need are the hibernate entitymanager, and then one of the SLF4J registration packages. Everything else should be pulled into dependence:

    <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 currently bundled with hibernate-parent -->
        <version>1.5.8</version>
    </dependency>
+3
source

. ; , JTA JPA API Java EE, . 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 required by Hibernate -->
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-jcl</artifactId>
        <version>1.5.8</version>
    </dependency>
0

Source: https://habr.com/ru/post/1767004/


All Articles