0 Replies Latest reply on Jan 24, 2011 12:33 AM by yangju.richard.yang.pearson.com

    How to use SMPC if I have dynamic multiple persistence units

    yangju.richard.yang.pearson.com

      We have many datasources in our application (one datasource per customer). To make it worse, most datasources are unknown at development time. Sometimes we only get to know how many datasources and what they are after the deployment of the application into production.


      We are migrating our application to jboss 6 (currently AS 6 Final). We try to take advantage CDI beans, JPA2 and Seam 3. However, it seems that it is almost impossible to inject Persistence Units as they are unknown at development time. Did anybody here face the same issue? What is your solution.


      The entity manager factory can be jndi lookuped as we modify the persistence.xml every time we add a datasource in production.


      I tried to find a way to inject it. I even dreamed to use SMPC. But I could not find a solution. I ended up calling emf.createEntityManager() in the code (the emf is jndi lookuped). The em obtained this way cannot be managed by seam, right? But what if I want the em stays open across requests (to avoid lazyinitialization exception)?


      Please give me a direction.


      Thanks.