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
This commit is contained in:
A. Abram White 2007-03-02 21:57:03 +00:00
parent 6e30b565b7
commit ebe1b5711e
2 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -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);