Record is not clearing properly on remove

#1

I have a entity Agent which is one-to-many relationship with entity AgentGroup but when i delete Agent ,it is removed from db but in AgentGroup it is not removed properly. Agent is still there with all data null. I have attached a image for your reference. How to resolve this?

 

Thanks

#2

You have to remove it from the collection and then delete it.

Alternatively, if you use bidirectional relationship (mapped-by / inverse fields) with the agent as the owner side and the agent group as the mapped by side, you just have to delete the owner object in the relationship (the agent) and the mapped-by side (the agent group) will not include the removed object after it is removed from the database (a refresh may be needed).

ObjectDB Support

Reply