-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: dynamic properties for the persistence.xml
PostPosted: Wed Jul 20, 2011 10:10 am 
Newbie

Joined: Mon Apr 11, 2011 10:37 am
Posts: 4
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.