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:
Here is the details of all the jar files in the download:
Here is the screen shot of the directory content:
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.
Posted on: March 13, 2017 If you enjoyed this post then why not add us on Google+? Add us to your Circles