Hibernate 6 Maven Dependency

Hibernate 6 final is released and developers can use this version of ORM in their project. In this section we will tell you how to add Hibernate 6 maven dependency in your project.

Hibernate 6 Maven Dependency

Hibernate 6 - Hibernate 6 maven dependency

Hibernate is popular ORM tool which is used by developer to write data access layer for their application. In this section we are going to tell you how to use the Hibernate 6 maven dependency in your Java based project.

Hibernate ORM 6.0.0.Final was released on 2022-03-31 and it can be used in the production applications. There is strict requirements of Hibernate 6 ORM framework and as a developer you should know the requirements of this framework. Java requirement is at least Java 1.8 and JDBC 4.2 for Hibernate 5.2.

Hibernate 6 is compatible with:

  • Java 11, 17 or 18
  • Jakarta Persistence 3.1 and 3.0

Hibernate 6 Maven Dependency

There are the Deprecated features of Hibernate 6.x

  • The 'hibernate.classLoader.application', 'hibernate.classLoader.resources', 'hibernate.classLoader.hibernate' and 'hibernate.classLoader.environment' are deprecated and developer should use 'hibernate.classLoaders' instead.
     
  • The 'hibernate.hbm2dll.create_namespaces' is also deprecated , so, developers should use 'jakarta.persistence.create-database-schemas' or 'hibernate.hbm2ddl.create_namespaces'

If you are migrating your application from old Hibernate version then you should update above deprecated packages in your applications.

Hibernate core 6 final maven dependency

Hibernate core 6 final ORM dependency (Hibernate 6 jar files) is distributed over the maven repository and it can be download in project through maven, Gradle, Gradle (Short), Gradle (Kotlin), SBT, Ivy, Grape, Leiningen and Buildr tools. But most of the developers are using Maven and Gradle for building their application.

If you are using Maven then add following dependency code in your pom.xml file of your project:

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

If you are using the Gradle build tool then you can add following as dependency:

implementation group: 'org.hibernate.orm', name: 'hibernate-core', version: '6.0.0.Final'

The Gradle short dependency is:

implementation 'org.hibernate.orm:hibernate-core:6.0.0.Final'

For Gradle (Kotlin) you can use following dependency code:

implementation("org.hibernate.orm:hibernate-core:6.0.0.Final")

For SBT following code can be used to add Hibernate 6 final:

libraryDependencies += "org.hibernate.orm" % "hibernate-core" % "6.0.0.Final"

For Ivy following dependency code can be added:

<dependency org="org.hibernate.orm" name="hibernate-core" rev="6.0.0.Final"/>

If you are using Jakarta JPA API then use following dependency in your pom.xml:

<dependency>
	<groupId>org.hibernate</groupId>
	<artifactId>hibernate-core-jakarta</artifactId>
	<version>6.0.0.Final</version>
</dependency>
<dependency>
	<groupId>org.glassfish.jaxb</groupId>
	<artifactId>jaxb-runtime</artifactId>
	<version>3.0.0</version>
</dependency>

Maven tool helps in managing the dependency in the project very well. It finds out the dependent libraries and then download it automatically in your project. These days developers heavily depends on the Maven project management tool for building their project. There are many advantages of using Maven for your project. You can check more tutorials on Maven at Apache Maven Tutorials and Dependencies.

In this section we have explained you the dependency code that you can add to your maven pom.xml file for getting the Hibernate 6 ORM dependency in your project.

Related Tutorials