Is there a way to dinamically switch EntityManager's DataSource to working with more then one datanase? For this time I found only way described here:
http://community.jboss.org/message/356772
"bill.burke@jboss.com" wrote:
deploy your entities as you would but assign them a JNDI name(see docs). In your EJB interceptor pick the appropriate JNDI name of the EntityManager you want to access. Either inject the ENtityManager into the field of your bean using a custom annotation, or stuff the chosen entity manager into a java.lang.ThreadLocal. This way you still get the automatic session management that the EJB/Java Persistence integration gives you. Following me?