Hibernate OGM is not maintained anymore

Today we release Hibernate OGM 5.1.0.Beta1 and 5.0.3.Final.

In version 5.1 we introduce an amazing new feature: support for storing data in Infinispan Server using the Java Hot Rod client, encoding your data into Google Protobuffers, while handling all the nasty mapping automatically.

Hot Rod support?

Hot Rod is the protocol used by "intelligent clients" of an Infinispan Server, which implies the client is smart enough to implement a series of performance optimisation tricks; for example it is able to connect to the most suited server in the cluster depending on the data being requested (or written), greatly reducing the latency of operations.

While Infinispan is most known as an high-performance key/value store, when it comes to remote clients the recommended approach is to encode your data in Google Protobuffers. This allows for evolution of your storage schema without breaking decoding of existing data, allows server side queries and functions to interpret the stored data, and allows interoperability with Hot Rod clients from other programming languages. It allows for example to read the POJOs we write using the Java client from a Python client, and have the data converted into reasonable Python Objects.

Unfortunately dealing with an Hot Rod client can be tedious!

  • It’s a key-value store: manual handling of object relations is error prone

  • You’ll need to write and maintain a matching Protobuf Schema for all your entities

  • You’ll have to setup Protostream and configure it as Marshaller for the Hot Rod client

Most importantly, it requires new skills.

You’ll have to learn how a Protobuf Schema is best defined, and how to use Protostream. Finally, you’ll have to learn the Hot Rod API and how to make the most of its advanced flags to tune each operation, and consider carefully how you want to represent relations.

Use something familiar instead?

Hibernate OGM can automate the tedious parts, and let you focus on what matters: storing your objects.

Add this dependency:

<dependency>
    <groupId>org.hibernate.ogm</groupId>
    <artifactId>hibernate-ogm-infinispan</artifactId>
    <version>5.1.0.Beta1</version>
</dependency>

Enable OGM’s Hot Rod super powers in your persistence.xml :

<?xml version="1.0"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
        version="2.0">

        <persistence-unit name="ogm-with-hotrod">
                <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider> (1)
                <properties>
                        <property name="hibernate.ogm.datastore.provider"
                                value="infinispan_remote" /> (2)
                        <property name="hibernate.ogm.infinispan_remote.client.server_list"
                                value="127.0.0.1:11222" /> (3)
                </properties>
        </persistence-unit>
</persistence>
1 Choose Hibernate OGM as JPA Provider
2 pick infinispan_remote as datastore
3 include Hot Rod configuration properties, just replacing/adding the OGM prefix.

Start Hibernate OGM!

EntityManagerFactory emf = Persistence.createEntityManagerFactory("ogm-with-hotrod");

That’s enough to create Hibernate EntityManagers which knows how to perform CRUD of your model, encoding and decoding your data into Hot Rod!

This will:

  • Start and manage the Hot Rod client, have it initialize connections to your Infinispan Server

  • Generate an appropriate Protobuf Schema for your model

  • Deploy the schema to the Infinispan Server

  • Initialize all the internal Protobuf encoders and decoders using Protostream

  • Properly implement sequences / autoincrements (a feature lacking in native Hot Rod)

There are some limitations.

The most notable one is that you will have to manually create the Cache definitions that it will need on your Infinispan Server configuration, as at this time this is an operation which can’t be performed over Hot Rod (but the friendly Infinispan team is working on a solution).

Another limitation is that at this time we don’t support running JPQL queries on this backend.

You can find many more interesting details in our Infinispan integration reference guide; I’ve included a section to help you choose between Infinispan Embedded and Infinispan Remote (over Hot Rod).

Of course many more fixes made it into this release; for a full overview see the 5.1.0.Beta1 changelog.

Hibernate OGM 5.0.3.Final

We also released Hibernate OGM version 5.0.3.Final, to address a single mapping issue: many thanks to Simone Manetti for reporting OGM-1198, now resolved in this version.

Here is the full 5.0.3.Final changelog.

If you need to upgrade from a version before 5.0, you can find help in the migration notes.

What’s next?

Version 5.1 is feature complete now. We’re looking forward to your feedback!

How can I get in touch?

You can find us through the following channels:


Back to top