The goal of the Hibernate Object/Grid Mapper is to store data in any NoSQL store. The initial focus is on key/value pairs based storages, in particular Infinispan.
Entities are not stored in serializable blobs but rather as tuples, very much like in a relational database. In fact, we have been seriously studying the foundational relational model paper to see what to keep from the relational model http://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf
In the current implementation, the tuple is represented by a Map<String,Object> which is stored in the value of the key/value pair.
A tuple is essentially a Map<String,Object> whose key represent the column and the value represents the value of the column in primitive type.
Each tuple representing an entity is stored under a specific key in the Infinispan cache.
The key is composed of:
* the table name
* the entity id
Note that we kept the notion of table and column. It is essential to keep an abstraction between the object model and the data persistent model.
Collections are represented as a list of tuple today. The key is composed of:
- table name hosting the collection information
- column names representing the FK
- column values representing the FK
Some identifiers require seed storage in the datastore. This the case of most JPA generator strategy. There are not the most scalable solutions as it introduces a single point data, it is better to use custom id generators like UUID based generators.
Such seed is stored in the identifier cache by a specific key:
- table name
- column name representing the segment name
- column value representing the segment name
Each entry is unique to a given segment and stores the long based seed. We store it as such rather than using the tuple base approach to allow out of transaction replace / putIfAbsent operations.
Tuple should be (it's a TODO) stored as Infinispan's AtomicMap
All Grid related work is triggered by specific implementations of EntityPersister and CollectionPersister, respectively OgmEntityPersister and OgmCollectionPersister
Types are converted from the Hibernate Core types to GridTypes via a one to one mapping. A GridType is responsible for storing and retrieving data from the tuple.