if(container instanceof ExtendedInjectionContainer)
{
ExtendedInjectionContainer eic = (ExtendedInjectionContainer) container;
String beanName = eic.resolvePersistenceUnitSupplier(ref);
ManagedEntityManagerFactory managedFactory = ((org.jboss.jpa.deployment.PersistenceUnitDeployment) PersistenceUnitRegistry.getPersistenceUnit(beanName)).getManagedFactory();
return new InjectedSessionFactory(managedFactory);
}
log.warn("Container " + container + " does not implement ExtendedInjectionContainer");
PersistenceUnitDeployment deployment = container.getPersistenceUnitDeployment(ref);
if (deployment != null)
{
ManagedEntityManagerFactory managedFactory = deployment.getManagedFactory();
return new InjectedSessionFactory(managedFactory);
}
else
{
return null;
}