Closed makearl closed 10 years ago
I have added a fix for this issue in current trunk. Schema drop would only happen in case opted for "hibernate.hbm2ddl.auto" with value as "create" or "create-drop".
Thanks, -Vivek
I built with the latest and this is resolved. Thanks!
Hi,
I was following the Polyglot Persistence example with a few mocked-out databases for Cassandra and MariaDB: https://github.com/impetus-opensource/Kundera/wiki/Polyglot-Persistence
When creating an EntityManagerFactory for Cassandra by itself or for MariaDB by itself, everything works as expected and I was able to persist objects.
When creating an EntityManagerFactory that references both connections like in the Polyglot Persistence example, hibernate tries to drop the tables used in my Entity Classes from MariaDB.
Here's how I'm initializing the EntityManagerFactory for Polyglot Persistence: Map propertyMap = new HashMap(); propertyMap.put(CassandraConstants.CQL_VERSION, CassandraConstants.CQL_VERSION_3_0); EntityManagerFactory emf = Persistence.createEntityManagerFactory("cassandra_pu,maria_pu", propertyMap); EntityManager em = emf.createEntityManager();
Here's the persistence.xml file being used:
Here's an example of the output when trying to run with both the Maria and Cassandra persistence objects: 1294 [main] INFO org.hibernate.validator.util.Version - Hibernate Validator 4.2.0.Final Hibernate: Drop table users 1628 [main] WARN org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 1051, SQLState: 42S02 1628 [main] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Unknown table 'users' Hibernate: Drop table device Hibernate: Drop table sensor_test 1633 [main] WARN org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 1051, SQLState: 42S02 1633 [main] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Unknown table 'sensor_test'
Additional Information: I built Kundera from the tip of github a few days ago.