entityManager1 = new ReferenceCountedEntityManager((ExtendedEntityManager)entityManager);
if (JPA_LOGGER.isDebugEnabled())
JPA_LOGGER.debugf("created new ExtendedEntityManager for unit name=%s", unitName);
} else {
entityManager1.increaseReferenceCount();
entityManager = entityManager1.getEntityManager();
if (JPA_LOGGER.isDebugEnabled())
JPA_LOGGER.debugf("inherited existing ExtendedEntityManager from SFSB invocation stack, unit name=%s, " +
"%d beans sharing ExtendedEntityManager", unitName, entityManager1.getReferenceCount());
}