Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:
http://groups.google.com/group/kundera-discuss/subscribe
Apache License 2.0
903 stars 233 forks source link

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

Closed mayankqait closed 6 years ago

mayankqait commented 6 years ago

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

devender-yadav commented 6 years ago

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.

mayankqait commented 6 years ago

Thank you for updating on this.