Im trying to swap 2 persistence.xml files (ie 1persistence unit within one file) depending on the value of a jboss system property. we are using container management and dependency injection so ideally the 'switch' should work seamlessly without managing the entitymanagerfactory or entitymanager lifecycle. So the persistence unit name should stay the same.
we are using jboss 4.2.3GA which has Hibernate-entitymanager 3.3.1ga.
I have tried extending org.hibernate.ejb.HibernatePersistence and making reference to it in the persistence.xml ( <provider>com.x.y.BCPersistence</provider>)
overriding the method : EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map configOverrides) <update/change configOverrides map here> Ejb3Configuration cfg = new Ejb3Configuration(); Ejb3Configuration configured = cfg.configure( info, configOverrides ); factory = configured.buildEntityManagerFactory(); return factory;
however: the Ejb3configuration is always set to null.
I'd appreciate any help provided.
thanks.
|