My code:
emf = Persistence.createEntityManagerFactory("cassandra_pu");
em = emf.createEntityManager();
I change the persistence.xml dynamically to change to IP address of the cassandra_pu unit. However maybe it is executing too fast thus the old entity manager is returned instead of new one. Is there any way to check whether the created em entity manager good enough to use or not?
It might depend on the EJB container in use, but in general changes to
persistence.xmlwon’t be reflected until the next redeploy of the application – so the “old” entity manager will be returned over and over again until you redeploy.