You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/08/16 17:50:11 UTC
svn commit: r1618377 -
/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
Author: rmannibucau
Date: Sat Aug 16 15:50:11 2014
New Revision: 1618377
URL: http://svn.apache.org/r1618377
Log:
TOMEE-1295 support openjpa.EntityManagerFactoryPool, we can think to support more properties but that's the first one which is really particular so waiting for real use case
Modified:
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java?rev=1618377&r1=1618376&r2=1618377&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java Sat Aug 16 15:50:11 2014
@@ -29,6 +29,7 @@ import java.util.concurrent.Callable;
public class EntityManagerFactoryCallable implements Callable<EntityManagerFactory> {
public static final String OPENEJB_JPA_INIT_ENTITYMANAGER = "openejb.jpa.init-entitymanager";
+ public static final String OPENJPA_ENTITY_MANAGER_FACTORY_POOL = "openjpa.EntityManagerFactoryPool";
private final String persistenceProviderClassName;
private final PersistenceUnitInfoImpl unitInfo;
@@ -53,6 +54,9 @@ public class EntityManagerFactoryCallabl
if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) {
properties.put("javax.persistence.validator.ValidatorFactory", new ValidatorFactoryWrapper());
}
+
+ customizeProperties(properties);
+
final EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties);
if (unitInfo.getProperties() != null
@@ -75,6 +79,14 @@ public class EntityManagerFactoryCallabl
}
}
+ // properties that have to be passed to properties parameters and not unit properties
+ private void customizeProperties(final Map<String, Object> properties) {
+ final String pool = SystemInstance.get().getProperty(OPENJPA_ENTITY_MANAGER_FACTORY_POOL);
+ if (pool != null) {
+ properties.put(OPENJPA_ENTITY_MANAGER_FACTORY_POOL, pool);
+ }
+ }
+
public PersistenceUnitInfoImpl getUnitInfo() {
return unitInfo;
}