[hibernate-dev] Proposal for a Redis module in Hibernate OGM

Mark Paluch mpaluch at paluch.biz
Fri Jul 17 11:16:58 EDT 2015


Hi there,

I created a Redis module for Hibernate OGM, based on OGM 4.2. Redis is a
Key-Value store supporting Lists, Hashes (Maps), Sorted Sets, ...

I took the Infinispan/CouchDB approach storing entities and associations as
JSON documents within Redis Hashes. A Map<Object, Map<Object, Object>>
corresponds with a Redis Hash.

The entity table maps to the Hash Id, the entity Id to the key of the hash
and the set of columns is enclosed within a JSON (currently). Supported
features are:

* Composite Id's
* Embedded associations
* External associations

and I guess many more, that I'm currently not aware of :-)

There are various ways (JSON, Java-serialized simulating Documents) how to
store data within Redis.
Another approach could be storing Tuples within Redis more native, since
they are in the end Maps, somehow. However, mapping tuples to Redis fit a
native storage but raises questions about Id's, limited data type support
(there is no equivalent for nested lists/maps). So the more native approach
would require distributing data amongst various data types, depending on
the supported features, and would require more IO's.

My impl can be used to interoperate with other clients from the C, Ruby,
Python, Node.js, ... worlds. The JSON is clean and does not look awkward on
the first look.

The current code can be found below
https://github.com/mp911de/hibernate-ogm/tree/redis. Most TCK tests pass,
only some 15 tests fail. Mostly due to enum and JTA support. Couldn't
figure out, how to fix it, so need your help to figure it out.

Hope, I made you hungry for the Redis OGM module. Let's start a discussion
based on my proposal for inclusion and let's see, where we end up.

Best regards, Mark


More information about the hibernate-dev mailing list