cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: Deleted objects showing up a serialized data context
Date Wed, 26 Jul 2006 23:17:12 GMT
On 7/26/06, Andrus Adamchik <andrus@objectstyle.org> wrote:
> It is now :-)  Something's wrong with delete rules then. You may need
> to put a breakpoint in delete code to see that nullify delete rule
> actually cleans the collection.

I've now created a simpler test case without the web framework
involved, so I know that the problem isn't being caused by other
interactions nor by my custom readObject resolveRead methods (which
aren't being called).

And with the changes to ToManyList, I've now been able to see that
removedFromUnresolved contains a reference to my deleted object.

value= ToManyList  (id=206)
	addedToUnresolved= LinkedList  (id=212)
	objectList= null
	relationship= "feeCycleList"
	removedFromUnresolved= LinkedList  (id=217)
	source= MonthPayableType  (id=134)

Maybe the problem is that ToManyList simply needs to call
resolvedObjectList on writeObject?   That seems like it'd add a lot of
overhead.

I noticed that in ToManyList.removeLocal that if an object is already
in the add list, it's removed but still added to the remove list.
The same thing is true for addLocal.

boolean removeLocal(Object object) {
        if (addedToUnresolved != null) {
            addedToUnresolved.remove(object);
        }

        if (removedFromUnresolved == null) {
            removedFromUnresolved = new LinkedList();
        }

        removedFromUnresolved.addLast(object);

        // this is really meaningless, since we don't know
        // if an object was present in the list
        return true;
    }

For example, during the delete, the NEW (soon to be DELETED) object
moves from the added list to the removedList.


value= ToManyList  (id=238)
	addedToUnresolved= LinkedList  (id=241)
		header= LinkedList$Entry  (id=245)
			element= null
			next= LinkedList$Entry  (id=247)
				element= FeeCycle  (id=188)
					isInTemporaryDataContext= false
					objectContext= DataContext  (id=126)
					objectId= ObjectId  (id=257)
					persistenceState= 1
					snapshotVersion= -9223372036854775808
					values= HashMap  (id=258)
				next= LinkedList$Entry  (id=245)
					element= null
					next= LinkedList$Entry  (id=247)
					previous= LinkedList$Entry  (id=247)
				previous= LinkedList$Entry  (id=245)
			previous= LinkedList$Entry  (id=247)
		modCount= 1
		size= 1
	objectList= null
	relationship= "feeCycleList"
	removedFromUnresolved= null
	source= MonthPayableType  (id=197)


value= ToManyList  (id=238)
	addedToUnresolved= LinkedList  (id=241)
		header= LinkedList$Entry  (id=245)
			element= null
			next= LinkedList$Entry  (id=245)
				element= null
				next= LinkedList$Entry  (id=245)
				previous= LinkedList$Entry  (id=245)
			previous= LinkedList$Entry  (id=245)
		modCount= 2
		size= 0
	objectList= null
	relationship= "feeCycleList"
	removedFromUnresolved= LinkedList  (id=274)
		header= LinkedList$Entry  (id=320)
			element= null
			next= LinkedList$Entry  (id=321)
				element= FeeCycle  (id=188)
					isInTemporaryDataContext= false
					objectContext= DataContext  (id=126)
					objectId= ObjectId  (id=257)
					persistenceState= 1
					snapshotVersion= -9223372036854775808
					values= HashMap  (id=258)
				next= LinkedList$Entry  (id=320)
					element= null
					next= LinkedList$Entry  (id=321)
					previous= LinkedList$Entry  (id=321)
				previous= LinkedList$Entry  (id=320)
			previous= LinkedList$Entry  (id=321)
		modCount= 1
		size= 1
	source= MonthPayableType  (id=197)

Maybe the solution instead should be that when removing an object and
it's found in the added list, DON'T put it into the removed list at
this point (the removal from the added list is sufficient.)

This might also be true for addLocal().

=============================================================

Here's an early piece of speculation which may point to other problems
-- it's similar to the added/removed situation above:

Could this be caused by having both the create and delete
ArcOperations in the ObjectStore after the object was deleted?

[0]= ObjectDiff$ArcOperation  (id=665)
	arcId= "feeCycleList"
	delete= false
	diffId= 42
	nodeId= ObjectId  (id=385)
	targetNodeId= ObjectId  (id=478)
[1]= ObjectDiff$ArcOperation  (id=666)
	arcId= "feeCycleList"
	delete= true
	diffId= 62
	nodeId= ObjectId  (id=385)
	targetNodeId= ObjectId  (id=478)

Should the second event cancel out the first, and both events be
removed?  This is the only reference I'm finding to the deleted object
in the ObjectStore after the object is deleted (which could just mean
that I've missed it).

Also, setting a breakpoint on CayenneDataObject.writeObject and
looking at the value of FeeCycleType gives this:

value= ToManyList  (id=616)
	addedToUnresolved= null
	objectList= ArrayList  (id=619)
	relationship= "feeCycleList"
	removedFromUnresolved= null
	source= FeeCycleType  (id=580)

Mime
View raw message