public synchronized EntityManagerFactory resolve(String unitName, PersistenceOverrides overrides, ClassLoader classLoader) throws Fabric3Exception { EntityManagerFactory resolvedEmf = cache.get(unitName); if (resolvedEmf != null) { return resolvedEmf; } EntityManagerFactory factory = createEntityManagerFactory(overrides, classLoader); URI key; if (classLoader instanceof MultiParentClassLoader) { key = ((MultiParentClassLoader) classLoader).getName(); } else { key = Names.HOST_CONTRIBUTION; } cache.put(key, unitName, factory); return factory; }
public EntityManager getEntityManager(String unitName, HibernateProxy proxy, Transaction transaction) throws Fabric3Exception { // Note this method is thread-safe as a Transaction is only visible to a single thread at time. Key key = new Key(transaction, unitName); EntityManager em = cache.get(key); if (em == null) { // no entity manager for the persistence unit associated with the transaction EntityManagerFactory emf = emfCache.get(unitName); if (emf == null) { throw new Fabric3Exception("No EntityManagerFactory found for persistence unit: " + unitName); } em = emf.createEntityManager(); // don't synchronize on the transaction since it can assume to be bound to a thread at this point registerTransactionScopedSync(proxy, key); cache.put(key, em); } return em; }
public EntityManager getEntityManager(String unitName, HibernateProxy proxy, Transaction transaction) throws Fabric3Exception { // Note this method is thread-safe as a Transaction is only visible to a single thread at time. Key key = new Key(transaction, unitName); EntityManager em = cache.get(key); if (em == null) { // no entity manager for the persistence unit associated with the transaction EntityManagerFactory emf = emfCache.get(unitName); if (emf == null) { throw new Fabric3Exception("No EntityManagerFactory found for persistence unit: " + unitName); } em = emf.createEntityManager(); // don't synchronize on the transaction since it can assume to be bound to a thread at this point registerTransactionScopedSync(proxy, key); cache.put(key, em); } return em; }
public synchronized EntityManagerFactory resolve(String unitName, PersistenceOverrides overrides, ClassLoader classLoader) throws JpaResolutionException { EntityManagerFactory resolvedEmf = cache.get(unitName); if (resolvedEmf != null) { return resolvedEmf; } EntityManagerFactory factory = createEntityManagerFactory(overrides, classLoader); URI key; if (classLoader instanceof MultiParentClassLoader) { key = ((MultiParentClassLoader) classLoader).getName(); } else { key = Names.HOST_CONTRIBUTION; } cache.put(key, unitName, factory); return factory; }
public EntityManager getEntityManager(String unitName, HibernateProxy proxy, Transaction transaction) throws EntityManagerCreationException { // Note this method is thread-safe as a Transaction is only visible to a single thread at time. Key key = new Key(transaction, unitName); EntityManager em = cache.get(key); if (em == null) { // no entity manager for the persistence unit associated with the transaction EntityManagerFactory emf = emfCache.get(unitName); if (emf == null) { throw new EntityManagerCreationException("No EntityManagerFactory found for persistence unit: " + unitName); } em = emf.createEntityManager(); // don't synchronize on the transaction since it can assume to be bound to a thread at this point registerTransactionScopedSync(proxy, key); cache.put(key, em); } return em; }
public synchronized EntityManagerFactory resolve(String unitName, PersistenceOverrides overrides, ClassLoader classLoader) throws Fabric3Exception { EntityManagerFactory resolvedEmf = cache.get(unitName); if (resolvedEmf != null) { return resolvedEmf; } EntityManagerFactory factory = createEntityManagerFactory(overrides, classLoader); URI key; if (classLoader instanceof MultiParentClassLoader) { key = ((MultiParentClassLoader) classLoader).getNameUri(); } else { key = Names.HOST_CONTRIBUTION; } cache.put(key, unitName, factory); return factory; }