Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Roel Stolker
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store DB4O (ARCHIVED)

SCO wrapped fields are persisted sometimes

Created: 20/Aug/08 03:48 PM   Updated: 09/Sep/08 10:53 AM
Component/s: None
Affects Version/s: 1.0.0.m4
Fix Version/s: None

File Attachments: 1. Zip Archive (161 kB)

Datastore: DB4O

 Description  « Hide
Happens when nesting objects of the same type in an Hashtable. For example;

We have an A object with an children Hashtable containing two other A objects:

children - A

                - A

A a = new A();
A child1 = new A();
A child2 = new A();

After persisting "a" to the datastore we give "child2" a child:

children - A

                - A
                   children - A

child2_1 = new A();

So now there's a child on the second level. We persist this again to update the changes.

Looking at the datastore some new objects of the following types are added:

It also appears that there are 6 A objects instead of 4. I think this is because DB4O persists the A objects with SCO fields as new objects. Also when reading back the first A object the A object "child2_1" is missing.

Looking at updateObject in DB4OPersistenceHandler it seems that the call to replaceAllLoadedSCOFieldsWithValues does not unwrap the SCO fields on the second level.

Roel Stolker added a comment - 20/Aug/08 03:50 PM
Testcase added.

Roel Stolker made changes - 20/Aug/08 03:50 PM
Field Original Value New Value
Attachment [ 10780 ]
Roel Stolker added a comment - 09/Sep/08 08:48 AM - edited
Concerning the persisted DatastoreUniqueOID objects.

It seems that the jdoDetachedState field of a PC has the DatastoreUniqueOID object after detaching. When updating this PC with updateObject DB4O sees this object as a new object because we set the OID in the jdoDetachedState array. This results in writing the PC as a new object in the datastore, causing a duplicate.

Roel Stolker made changes - 09/Sep/08 10:50 AM
Comment [ I was not correct about the statemanager. It seems that the field jdoDetachedState of a PC is the problem.

This field is also persisted and contains an DatastoreUniqueOID object. ]