From ebe1b5711e4347898cd8e7f4e7a9b7baa18dea26 Mon Sep 17 00:00:00 2001 From: "A. Abram White" Date: Fri, 2 Mar 2007 21:57:03 +0000 Subject: [PATCH] Fix a couple of errors in the code to default to the non-finalizing broker in PersistenceProviderImpl.createContainerManagedEntityManagerFactory: 1) Don't add to the given Map, because it might be read-only. 2) Prefix the BrokerImpl property correctly when adding it. git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@513974 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/conf/OpenJPAConfigurationImpl.java | 2 +- .../persistence/PersistenceProviderImpl.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java index 0adcd4546..edbee2b6d 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java @@ -71,7 +71,7 @@ public class OpenJPAConfigurationImpl // openjpa properties public ObjectValue classResolverPlugin; - public BrokerValue brokerPlugin; + public ObjectValue brokerPlugin; public ObjectValue dataCachePlugin; public ObjectValue dataCacheManagerPlugin; public IntValue dataCacheTimeout; diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java index ccca49230..a0fa1032f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java @@ -83,15 +83,6 @@ public class PersistenceProviderImpl PersistenceUnitInfo pui, Map m) { PersistenceProductDerivation pd = new PersistenceProductDerivation(); try { - // if the BrokerImpl hasn't been specified, switch to the - // non-finalizing one, since anything claiming to be a container - // should be doing proper resource management. - if (!Configurations.containsProperty(BrokerValue.KEY, - pui.getProperties()) - && !Configurations.containsProperty(BrokerValue.KEY, m)) { - m.put(BrokerValue.KEY, BrokerValue.NON_FINALIZING_ALIAS); - } - ConfigurationProvider cp = pd.load(pui, m); if (cp == null) return null; @@ -102,6 +93,15 @@ public class PersistenceProviderImpl pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, pui.getNewTempClassLoader())); + // if the BrokerImpl hasn't been specified, switch to the + // non-finalizing one, since anything claiming to be a container + // should be doing proper resource management. + if (!Configurations.containsProperty(BrokerValue.KEY, + cp.getProperties())) { + cp.addProperty("openjpa." + BrokerValue.KEY, + BrokerValue.NON_FINALIZING_ALIAS); + } + BrokerFactory factory = Bootstrap.newBrokerFactory(cp, pui.getClassLoader()); return OpenJPAPersistence.toEntityManagerFactory(factory);