Very good post by Emmanuel Bernard on the Hibernate blog explaining why Hibernate OGM was created, how it works, and what the plan is.
Why Hibernate OGM
At JBoss, we strongly believe that provided tools become available, developers, applications and whole corporations will exploit new data usage patterns and create value out of it. We want to speed up this adoption / experimentation and bring it to the masses. NoSQL is like sex for teenagers: everybody is talking about it but few have actually gone for it. It’s not really surprising, NoSQL solutions are inherently complex, extremely diverse and come with quite different strengths and weaknesses: going for it implies a huge investment (in time if not money). (One of) JBoss’s goal is to help lower the barrier of entry and Hibernate OGM is right inline with this idea.
This sounds like the expanded version of what I was writing about Spring Data. Both Spring framework and Hibernate have been accepted inside enterprises for a long time now. If they start providing integrations with NoSQL databases, then the enterprise teams will not have to go through the long acceptance cycles anymore.
How Hibernate OGM Works?
Entities are stored as tuples which essentially is a Map where the key is the column name and the value is the column value. In most cases, the property is mapped to a column but this can be de-correlated (@Column). An entity tuple is accessible via a single key lookup. Associations as a bit trickier because unlike RDBMs, many NoSQL stores and Grid specifically do not have build-in query engines and thus cannot query for associated data easily. Hibernate OGM stores navigational information to go from a given entity to its association information. This is achieved by a single key lookup. The drawback here is that writing requires several key lookup / update operations.
The post provides more details about how Hibernate OGM plans to address the mismatches between the object world and NoSQL storages, but also those between NoSQL storages and the JPA specification. Worth keeping in mind is that even if Hibernate OGM will bring the JPA standard to NoSQL databases, there will be many limitations to what can be done due to the different natures of the models involved. More advanced projects will probably need custom serializers/deserializers, special query implementors, etc.
The future of Hibernate OGM
- support for other key/value pair systems
- support for other NoSQL engine
- declarative denormalization: we have focused on feature so far, performance check and association denormalization is planned)
- support for complex JP-QL queries including to-many joins and aggregation
- fronting existing JPA applications
Hibernate OGM has a long way to go. The list of NoSQL databases Spring Data integrates with is longer for now: Redis, Riak, Neo4j and a couple more.
Original title and link: Hibernate OGM: Why, What, How (NoSQL database©myNoSQL)