Index<EntityManagerFactory, Map> factories = deploymentInfo.getExtendedEntityManagerFactories();
Index<EntityManagerFactory, EntityManager> entityManagers = null;
if (factories != null && factories.size() > 0) {
entityManagers = new Index<EntityManagerFactory, EntityManager>(new ArrayList<EntityManagerFactory>(factories.keySet()));
for (Map.Entry<EntityManagerFactory, Map> entry : factories.entrySet()) {
EntityManagerFactory entityManagerFactory = entry.getKey();
Map properties = entry.getValue();
EntityManager entityManager = entityManagerRegistry.getInheritedEntityManager(entityManagerFactory);
if (entityManager == null) {
if (properties != null) {
entityManager = entityManagerFactory.createEntityManager(properties);
} else {
entityManager = entityManagerFactory.createEntityManager();
}
}
entityManagers.put(entityManagerFactory, entityManager);
}
}