Restrict Child Duplicates On Creating Object In Db4o
It's a very common situation, but I'm kinda new using ORM especially in Android, so your help would be awesome. Scope: Object, e.g. Message has primitive fields and field (child) o
Solution 1:
Db4o does not know that you intend different Discussion objects to be merged, just since they have the same id field. Db4o distinguishes objects by their identity (i.e. the ==
operator), not any fields of the object. You can have hundreds of equal objects in the database.
There is no reason to create a new Discussion
object for each Message
- retrieve the existing one, and set it as the discussion
field of your new Message object.
Post a Comment for "Restrict Child Duplicates On Creating Object In Db4o"