when a method of my EJB is invoked I get the information to which database to connect by passing the datasource name (not the name exactly). Therefore I cannot define all datasources in persistence.xml fixed. I instantiate the EntityManagerFactory and EntityManager by myself and this I think hinders the usage of JTA, CMT with JBoss. The transaction cannot be joined by hibernate. Is there a concept existing to handle this "datasource by EJB invokation" approach?
It runs if I do it without JTA, CMT and with RESOURCE_LOCAL and BMT. Maybe I can tell JBoss which EntityManagerFactory to use?