pluginMgr, new DatastorePluginRegistry((PluginRegistry) registryField.get(pluginMgr)));
}
private static OMFContext addDefaultPropertyValues(OMFContext omfContext) {
PersistenceConfiguration conf = omfContext.getPersistenceConfiguration();
// There is only one datastore so set this to true no matter what.
conf.setProperty("datanucleus.attachSameDatastore", Boolean.TRUE.toString());
// Only set this if a value has not been provided
if (conf.getProperty(DatastoreConnectionFactoryImpl.AUTO_CREATE_TXNS_PROPERTY) == null) {
conf.setProperty(
DatastoreConnectionFactoryImpl.AUTO_CREATE_TXNS_PROPERTY, Boolean.TRUE.toString());
}
// We'd like to respect the user's selection here, but the default value is 1.
// This is problematic for us in the situation where, for example, an embedded object
// gets updated more than once in a txn because we end up putting the same
// entity twice.
// TODO(maxr) Remove this once we support multiple puts
conf.setProperty("datanucleus.datastoreTransactionFlushLimit", Integer.MAX_VALUE);
/*
* The DataNucleus query cache has a pretty nasty bug where it caches the symbol table along with
* the compiled query. The query cache uses weak references so it doesn't always happen, but if
* you get a cache hit and your param values are different from the param values in the cached
* symbol table, your query will execute with old param values and return incorrect results.
*/
conf.setProperty("datanucleus.query.cached", false);
return omfContext;
}