0 Replies Latest reply on Jun 13, 2006 4:06 AM by hoagiex

    How to initialize an EntityManagerFactory in a self containe

    hoagiex

      I have a 'modulename'.jar containing all classes relevant to the data integration tier. This is a plug and play module which must not have dependencies outside of the module. The problem is that I can't create an EntityManagerFactory in a managed transaction or I get the following exception:

      java.sql.SQLException: You cannot set autocommit during a managed transaction!
      


      If I obtain the Factory from a dummy SessionBean that does not support transactions, all persists I do with the EntityManagers I obtain from the Factory aren't committed.

      So my question is:
      How can an EntityManagerFactory be created without the use of intervention from outside the designated module?

      (eg. initializing the Factory from a Servlet with load on startup enabled isn't a good solution for this project)