1 Reply Latest reply on Dec 1, 2011 12:04 PM by smarlow

    [AS7] Configure a default persistence unit in persistence.xml

    jsebfranck

      Hi,

       

      I have to configure several persistence units in persistence.xml. But it is possible to configure a default persistence unit?

       

      I would like to avoid to systematically fill in the unit-name of the @PersistenceContext annotation. For example :

       

      // Use the default persistence unit

      @PersistenceContext

      EntityManager defaultEntityManager;

       

      // Use the persistence unit named "specificPersistenceUnit"

      @PersistenceContext(unitName="specificPersistenceUnit")

      EntityManager specificEntityManager;

       

      Thank you in advance,