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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.