if (objval == null) {
// If we have an AUTOASSIGN strategy that means that we have a field that is GenerationType.IDENTITY so
// skip checking to see if the value is null as it will get assigned later in flush processing.
if (fmd.getValueStrategy() != ValueStrategies.AUTOASSIGN) {
if (fmd.getNullValue() == FieldMetaData.NULL_EXCEPTION || fmd.getDeclaredTypeCode() == JavaTypes.OID)
throw new InvalidStateException(_loc.get("null-value", fmd.getName(), _sm.getManagedInstance()))
.setFatal(true);
}
return false;
}
// nothing else to do for non-persistent
if (fmd.getManagement() != FieldMetaData.MANAGE_PERSISTENT)
return false;
// don't allow managed objectid field value
if (fmd.getDeclaredTypeCode() == JavaTypes.OID) {
_sm.assertNotManagedObjectId(objval);
if (_sm.getObjectId() != null
&& !objval.equals(((ObjectId) _sm.getObjectId()).getId()))
throw new InvalidStateException(_loc.get("changed-oid",
_sm.getObjectId(), objval,
Exceptions.toString(_sm.getManagedInstance()))).
setFatal(true);
}