Currently ObjectDB doesn't prevent deletion of entity objects that are in use and referenced by other entity objects, and it is the application responsibility to avoid such deletion.
During development and testing it is recommended to use the ObjectDB Doctor to verify that reference integrity is not broken and there are no dangling references.
Future versions of ObjectDB should support reference integrity.