Db4o to preserve the identity of objects

Is there a way to store the id of the object in db4o.

Suppose I store BigDecimal in inline db4o.

When I read it twice, I get two different objects with the same value (which is quite obvious).

Is there any parameter to force db4o to cache the query results so that the two queries return a reference to the same instance, or should I do this myself?

0


a source to share


3 answers


In my experience, doing the same query twice on the same ObjectContainer should return the same (identical) objects every time.



You should not close and reopen the ObjectContainer between requests if you need object identification.

+1


a source


Db4o uses IDs and UUIDs internally and you can access them if needed. Also worth reading this .



0


a source


you can make an id for each of your object using its UUID, i mean add an attribute id for the object and give it a UUID value and store it to update the object you can get with that id and update it

0


a source







All Articles