Installation and configuration
Before Hibernate can be used in an application, the library has to be installed and configured.
Installation of Hibernate
The Hibernate ORM can be downloaded from http://hibernate.org/orm/ as a zip file containing a collection of JAR files that have to be added to the classpath manually.
As Hibernate depends on a couple of other open source libraries, it is recommended to let a build tool like Maven or Gradle resolve the dependencies automatically by adding a dependency to the hibernate-core module of the build file.
Note
The examples in this chapter refer to the Version 4.3.7.Final of Hibernate ORM.
Configuring Hibernate
Before Hibernate can be used, it has to be configured with the correct connection parameters and the database driver to use. This can be done either by using an XML file (hibernate.cfg.xml
) or a properties file (hibernate.properties
). In both cases, the file should be stored in the classpath, normally in src/main/resources/
, if the Mavens standard...