1 Reply Latest reply on Nov 6, 2012 1:23 PM by George Gastaldi


    Marcio Jota Coelho Newbie

      Hi guys...

      I changed my forge project to use 2 persistence units.

      But.. I need change the managed bean generated by "scaffold from-entity", to change units in runtime.


      I created a class to use this like a factory:




      public class AppEntityManagerFactory {


          public EntityManager getAppEntityManager(){

              EntityManagerFactory emf=Persistence.createEntityManagerFactory("forge-default");

              EntityManager em=emf.createEntityManager();

              return em;




      And in managed bean, I removed @PersistenceContext annotation at entityManager and I changed it to instanciate my class;

      private EntityManager entityManager=new AppEntityManagerFactory().getAppEntityManager();

      I get this error at debug.



      This is my persistence.xml