Introduction to ORM and Hibernate
While relational databases represent data in a tabular form, object-oriented programming languages organize the data in a graph of objects that reference each other. This results in different approaches for accessing and manipulating stored data.
An ORM framework translates between tabular and object representation, and creates a kind of virtual object database that can be used from within an application.
Hibernate overview and architecture
Hibernate is an open-source persistence framework for Java. Beside the ORM module, which will be discussed in the context of this chapter, it provides additional modules and tools for accessing the NoSQL data-stores, adding full-text search, or for validating data.
The Hibernate ORM module takes care of the mapping between the database tables and Java classes, and largely, reduces the amount of code needed to implement data persistence.
Hibernate inserts a layer between the Java application and JDBC, as shown in the following...