Hello, I'm developing an application and I have to use the same JPA beans in 
multiple databases in the same application. The solution that I've thought is 
to create various persistence units, one for every database and use them in my 
beans. The problem of this approach is that I cannot use the 
@PersistenceContext or @PersistenceUnit annotations since the persistence unit 
for those elements is fixed and I need to get it programatically. On every 
request I have to decide which database to use. 
I tried using the Persistence.createEntityManagerFactory call in my EJB but it 
fails because my datasource (and my persistence unit) are configured to use JTA 
and I get the error:

Caused by: org.hibernate.HibernateException: The chosen transaction strategy 
requires access to the JTA TransactionManager

I could configure them as RESOURCE_LOCAL but I'm only going to use them in EJBs 
and I'd like to have automatic transaction management, and so, I want JTA.

I don't know if that's possible. Has anybody managed to get it? Do I have to 
loose JTA?

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266582#4266582

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266582
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to