public OpenJPAEntityManagerFactory createContainerEntityManagerFactory(
PersistenceUnitInfo pui, Map m) {
PersistenceProductDerivation pd = new PersistenceProductDerivation();
try {
ConfigurationProvider cp = pd.load(pui, m);
if (cp == null)
return null;
// add enhancer
Exception transformerException = null;
String ctOpts = (String) Configurations.getProperty
(CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
try {
pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
pui.getNewTempClassLoader()));
} catch (Exception e) {
// fail gracefully
transformerException = e;
}
// 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());