Hello everyone,
Following a discussion I had with a colleague of mine about polyglot
persisting, I was wondering if it could be possible to store entities into
one datastore and associations into another one.
Let's take an example:
I'm developing an application like a social network, it can be interesting
to suggest new relations so a graph database is an interesting choice (to
store people relations) but profiles information can easily be stored into
a document store.
It can really be tough to manage the consistency between both datastores.
So here comes the polyglot module idea. We already have methods for
entities and methods for associations we just need to delegate calls either
to the dialect responsible for the entities or the dialect responsible for
the associations.
Starting from here I had 2 choices:
- create a module and some specific submodules to enable polyglot
capabilities
- create a module and invoke the existing modules (Infinispan, Ehcache and
MongoDB), manage the lifecycle of their datastore provider and dialect and
then delegate the appropriate calls
I choose the second option because it would a significant amount of work to
recreate new dialects (for " polyglot" mongodb, infinispan and ehcache)
and maintain the "classic" module and their "polyglot" siblings.
I have test the new module with all 6 combinations and all tests are
passing, the documentation has been updated and a branch is available on my
github repo [1].
So now I'm coming to you with a simple question:
WDYT ?
Cheers,
Guillaume
[1]
https://github.com/gscheibel/hibernate-ogm/tree/polyglot