Section 4. Integrate with Hibernate for Database Access

Most non-trivial web applications are going to be backed by a database, so let’s see how to do that with one of Java’s most popular Object to Relational Mapping (ORM) tools, Hibernate.

Fundamentally, Hibernate is a simple concept. You have Java classes and you have database tables that map to those classes. Hibernate provides a means for mapping classes to tables.

There are many ways to stitch persistence together with Hibernate. The Address Book application takes a three-step approach:

  i. Configure Hibernate

 ii. Create a Hibernate mapping file

iii. Implement Database Create/Read/Update/Delete (CRUD) Operations

i. Configure Hibernate

We’ve got to tell Hibernate about our database, ...

Get Google now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.