jaabax [https://community.jboss.org/people/jaabax] created the discussion
"Creating EntityManagers dynamically (e.g. through a config file or database)" To view the discussion, visit: https://community.jboss.org/message/739548#739548 -------------------------------------------------------------- Hi folks. Like I asked in the title, how do I create EntityManagers dynamically? A example is: I have 4 clients using my application (CompanyA, CompanyB, CompanyC, CompanyD). I do not want to create a @PersistenceContext for each one because tomorrow I can add the 5th one and this will require a new deploy and server restart (I want to store clients information on the database). I've read on Java EE 6 tutorial that I can use @PersistenceUnit to create an EntityManagerFactory and use createEntityManager() afterwards to create the EntityManager (and store the entity managers instances in a map for example). This is the right way to do it? I'm concerned about concurrency, best practices and etc. I am using JBoss AS 7 as my application server. Thanks in advance. -------------------------------------------------------------- Reply to this message by going to Community [https://community.jboss.org/message/739548#739548] Start a new discussion in EJB3 at Community [https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
_______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user