Hi!
I have a schema-full class with some mandatory and many optional fields (property isMandatory() -> false).
If I try to insert a document that does not contain an optional field I got this exception:
Caused by: com.orientechnologies.orient.core.exception.OValidationException: The field 'placeOfBirth' cannot be null
at com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.validateField(ORecordSchemaAwareAbstract.java:174)
at com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.validate(ORecordSchemaAwareAbstract.java:66)
at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1252)
at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1242)
at eu.optimaster.mai.database.DatabaseEngine.save(DatabaseEngine.java:665)
I really does not set setNullable(true) to this field but I'v set setMandatory(false)!
If I call setNullable(true) than it saves and when I reload it the document does not contain the field (which is the expected case).
But then if I set the field to 'null' than after save and reload the document will contain the field with 'null' value (which is also the expected case).
This is confusing because - in my oppinion - if a field is marked as NOT mandatory and the doc does not contain such fields that it should be saved without exceptions.