use of org.datanucleus.metadata.RelationType in project datanucleus-core by datanucleus.
the class PersistFieldManager method storeObjectField.
/**
* Method to store an object field.
* @param fieldNumber Number of the field (absolute)
* @param value Value of the field
*/
public void storeObjectField(int fieldNumber, Object value) {
if (value != null) {
if (replaceSCOsWithWrappers) {
// Replace any SCO field that isn't already a wrapper, with its wrapper object
boolean[] secondClassMutableFieldFlags = op.getClassMetaData().getSCOMutableMemberFlags();
if (secondClassMutableFieldFlags[fieldNumber] && !(value instanceof SCO)) {
// Replace the field with a SCO wrapper
value = SCOUtils.wrapSCOField(op, fieldNumber, value, true);
}
}
AbstractMemberMetaData mmd = op.getClassMetaData().getMetaDataForManagedMemberAtAbsolutePosition(fieldNumber);
if (mmd.isCascadePersist()) {
ClassLoaderResolver clr = op.getExecutionContext().getClassLoaderResolver();
RelationType relationType = mmd.getRelationType(clr);
if (relationType != RelationType.NONE) {
if (mmd.hasContainer()) {
processContainer(fieldNumber, value, mmd);
} else {
// Process PC fields
if (mmd.isEmbedded() || mmd.isSerialized()) {
processPersistable(value, fieldNumber, ObjectProvider.EMBEDDED_PC);
} else {
processPersistable(value, -1, ObjectProvider.PC);
}
}
}
}
}
}
Aggregations