18 Working with Hibernate OGM


This chapter covers

  • Introducing Hibernate OGM
  • Building a simple MongoDB Hibernate OGM application
  • Switching to the Neo4j NoSQL database

The world of databases is extremely diverse and complex. Besides the challenges of working with different relational database systems, the NoSQL world may make these challenges even higher. One goal of the persistence frameworks is to ensure the portability of the code, and we'll look now at the Hibernate OGM alternative and how it tries to support the JPA solution working with NoSQL databases.

18.1 Introducing Hibernate OGM

A NoSQL database is a database that keeps data in a format different than relational tables. In general, NoSQL databases provide the advantage of flexible schemas, meaning that the designer of the database does not have to determine the schema before persisting data. In applications that quickly change their requirements, this may be an important advantage regarding the development speed.

NoSQL databases may be classified according to the format they use to keep data:

18.2 Building a simple MongoDB Hibernate OGM application

18.2.1 Configuring the Hibernate OGM application

18.2.2 Creating the entities

18.2.3 Using the application with MongoDB

18.3 Switching to the Neo4j NoSQL database

18.4 Summary