Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:

Home Page:http://groups.google.com/group/kundera-discuss/subscribe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I have a query that Is it possible to persist same data in two different database simultaneously.

mayankqait opened this issue · comments

When i am trying this Schema is generated for both the databases(mysql and cassandra) but data is only persisted into one database()mysql.
Is it possible to persist data in boththe databases.

CassandraEmpTask.zip

Hi @mayankqait,

Using Polyglot persistence you can persist parts of relational entities in different databases. For example, if you have User and Address entities having one to many relationship. You want to save User in Cassandra and Address in Mysql; you can do it with polyglot persistence.

Now for saving the same entity in both the databases, you need to create 2 persistence-unit in your persistence.xml and need to create two EntityManagerFactory instances using each persistence-unit. Now create entityManager and save entity objects.

Thank you for updating on this.