Package org.apache.openejb.persistence

Examples of org.apache.openejb.persistence.EntityManagerTxKey


      throw new IllegalStateException("No JTAPersistenceContextManager service available");
   
    //Check if we, or OpenEJB, already have a context
    EntityManager ariesEM = mgr.getExistingPersistenceContext(emf);
    EntityManager openEjbEM = (EntityManager) OSGiTransactionManager.get().
                                  getResource(new EntityManagerTxKey(emf));
   
    if(ariesEM == null) {
      if(openEjbEM == null) {
        //If both are null then it's easier to let OpenEJB win and push the PC into Aries
        openEjbEM = super.getEntityManager(emf, props, extended, unitName);
      }
      mgr.manageExistingPersistenceContext(emf, openEjbEM);
      ariesEM = openEjbEM;
    } else {
      //We have an Aries EM, if OpenEJB doesn't then sort it out, if it does they should be the same
      if(openEjbEM == null){
        if(extended) {
          throw new IllegalStateException("We already have an active TX scope PersistenceContext, so we can't" +
            "create an extended one");
        } else {
          OSGiTransactionManager.get().putResource(new EntityManagerTxKey(emf), ariesEM);
          openEjbEM = ariesEM;
        }
      } else {
        //If both non null and not equal then something bad has happened
        if(openEjbEM != ariesEM) {
View Full Code Here

TOP

Related Classes of org.apache.openejb.persistence.EntityManagerTxKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.