How to download Hibernate 5.x?

In this section we will show you the available methods of downloading and getting Hibernate 5.x for your project.

How to download Hibernate 5.x?

How to download Hibernate 5.x and use library in your project?

In this section we will discuss the ways to include Hibernate 5 library (jar files) in your project. There are two ways to include the library in the project:

a) Include all the jar files in project

b) Use maven like tool which automatically downloads the jar files and include it in project on build, test or packaging time. In this case build tool will download all the necessary files from remote repository and include in the project at build time. You can use Maven build tool with Eclipse which eases the software development lifecycle.

How to download and include all the jar files in Project?

Latest version of Hibernate can be downloaded from its official website, you will find the links of downloading the old versions of Hibernate on the same official website.

To download Hibernate 5 visit http://hibernate.org/orm/downloads/ and the click on the download link as shown below:

Download Hibernate 5

Here is the details of all the jar files in the download:

  • The lib/required/ directory contains all the jar files of the hibernate-core and all these jar files needs to be added in your project.
     
  • The lib/envers directory contains the jar files of hibernate-envers module.
     
  • The lib/spatial/ directory have jar files necessary for spatial functionality of Hibernate
     
  • The lib/osgi/ directory contains jar files of hibernate-osgi module.
     
  • The lib/jpa-metamodel-generator/ directory contains all the jar files which is necessary for Criteria API type-safe Metamodel generation.
     
  • The lib/optional/ directory contains optional jar files for functionality such as connection pooling, seconday-level caching etc.

Here is the screen shot of the directory content:

Hibernate 5 library

Hibernate 5 Maven dependency pom.xml

If you are using Maven 5 in your project then its very easy to get Hibernate 5.x dependency in your project. Hibernate dependency is also distributed through central maven repository.

To use Hibernate 5 in your Maven project add following dependency:

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

If you are using Gradle then add following dependency:

compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.8.Final'

In this tutorial we have seen various ways to use the Hibernate 5.x library in a project. Check all the Hibernate 5 tutorials.