conf.metaFactoryPlugin.setString(SPEC_JPA.getName());
conf.nontransactionalWrite.setDefault("true");
conf.nontransactionalWrite.set(true);
Specification spec = ((OpenJPAConfiguration) c).getSpecificationInstance();
int specVersion = spec.getVersion();
Compatibility compatibility = conf.getCompatibilityInstance();
spec.setCompatibility(compatibility);
if (specVersion < 2) {
compatibility.setFlushBeforeDetach(true);
compatibility.setCopyOnDetach(true);
compatibility.setPrivatePersistentProperties(true);
compatibility.setIgnoreDetachedStateFieldForProxySerialization(true);
// Disable bean validation for spec level < 2 configurations
conf.validationMode.set(String.valueOf(ValidationMode.NONE));
} else {
compatibility.setAbstractMappingUniDirectional(true);
compatibility.setNonDefaultMappingAllowed(true);
}
return true;
}