You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Mike Kienenberger <mk...@gmail.com> on 2006/07/26 03:24:12 UTC

Deleted objects showing up a serialized data context

I'm now using incubator/cayenne/main/branches/STABLE-1.2.

One odd problem I'm hitting is serializing a DataContext created with
DataContext.createDataContext().

In my testing, I submit a web request that creates a new object,
submit a web request which creates another set of new objects and
assign it to relationships with my first new object, then submit a web
request which deletes the set of new objects.    At this point,
serialization writeObject fails on one of my internal assertions,
apparently because the deleted object is still in the context.

Here's what the summarized stack trace looks like (full trace below):

8     Fee(BaseDataObjectImpl).writeObject(ObjectOutputStream) line: 95
7     HashMap.writeObject(ObjectOutputStream) line: 978
6     FeeCycle(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
5     LinkedList.writeObject(ObjectOutputStream) line: 685
4     HashMap.writeObject(ObjectOutputStream) line: 978
3     FeeCycleType(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
2     HashMap.writeObject(ObjectOutputStream) line: 978
1     DataContext.writeObject(ObjectOutputStream) line: 1740


Fee in 8  and FeeCycle in 6 are transient objects -- no datacontext.
 FeeCycleType in 3 is a committed object.   It's a mystery to me how
FeeCycle in 6 is being picked up by the writeObject method chain.

My thoughts are that FeeCycle must be referenced in the hashmap at 4
for the FeeCycleType at 3.

The hashmap at 4 contains:

name=Monthly
feeCycleList=org.objectstyle.cayenne.access.ToManyList@10

and the ToManyList contains:

value= ToManyList  (id=614)
	addedToUnresolved= null
	objectList= ArrayList  (id=621)
		elementData= Object[10]  (id=655)
		modCount= 0
		size= 0
	relationship= "feeCycleList"
	removedFromUnresolved= null
	source= FeeCycleType  (id=400)

So what I'm at a loss to determine is how I get from the Hashmap in 4
to the LinkedList in 5, which is what contains my transient deleted
object (and related deleted objects).

The LinkedList in 5 contains:

this= LinkedList  (id=394)
	header= LinkedList$Entry  (id=641)
		element= null
		next= LinkedList$Entry  (id=673)
			element= FeeCycle  (id=387)
				isInTemporaryDataContext= true
				objectContext= null
				objectId= null
				persistenceState= 1
				snapshotVersion= 0
				values= HashMap  (id=375)
			next= LinkedList$Entry  (id=641)
			previous= LinkedList$Entry  (id=641)
		previous= LinkedList$Entry  (id=673)
	modCount= 1
	size= 1

The writeObject code for HashMap seems straight-forward, and we're
supposedly writing out a Map.Entry e getValue() result (debugger won't
show me what local variables are set to, but that's the line that's
showing up in my source code).

It seems like this linked list must be part of the serialization of
ToManyList (which does contain two linked lists), but looking at the
source for ToManyList, I don't see anything that matches up with what
I'd expect.

It looks like it must be serializing either addedToUnresolved or
removedFromUnresolved as these are the LinkedLists, but both of these
are null.

So....   Any ideas what I can do to try to track this down more?

=================
Possibly other relevent information:

I assume that 2 is writing out the hashmap of the ObjectStore, which
contains these 13 items.   There's no Fee reference here, nor are
there any references to non-committed FeeCycles.

<ObjectId:Contact, TEMP:000002574DF30161>={<ObjectId:Contact,
TEMP:000002574DF30161>; new; [phoneList=>(..); addressList=>(..);
contactNameList=>(..); tdWorkList=>(..); emailList=>(..);
primaryContactName=>{<ObjectId:ContactName, TEMP:000003574DF30161>}]}
<ObjectId:ContactName, TEMP:000003574DF30161>={<ObjectId:ContactName,
TEMP:000003574DF30161>; new; [allContactList=>(..);
primaryContactList=>(..)]}
<ObjectId:FeeCycleType,
FEE_CYCLE_TYPE_ID=100>={<ObjectId:FeeCycleType,
FEE_CYCLE_TYPE_ID=100>; modified; [feeCycleList=>(..); name=>None]}
<ObjectId:MonthPayableType,
MONTH_PAYABLE_TYPE_ID=113>={<ObjectId:MonthPayableType,
MONTH_PAYABLE_TYPE_ID=113>; modified; [feeCycleList=>(..);
name=>Monthly]}
<ObjectId:LegalParcel, TEMP:000006574DF30161>={<ObjectId:LegalParcel,
TEMP:000006574DF30161>; new; [meridianType=>{<ObjectId:MeridianType,
MERIDIAN_TYPE_ID=100>}; authorizationDocumentList=>(..);
parcel=>{<ObjectId:Parcel, TEMP:000007574DF30161>}]}
<ObjectId:ContactName, TEMP:000005574DF30161>={<ObjectId:ContactName,
TEMP:000005574DF30161>; new; [allContactList=>(..); fullName=>GVEA;
primaryContactList=>(..)]}
<ObjectId:MeridianType, MERIDIAN_TYPE_ID=100>={<ObjectId:MeridianType,
MERIDIAN_TYPE_ID=100>; modified; [name=>Fairbanks;
legalParcelList=>(..)]}
<ObjectId:LotType, LOT_TYPE_ID=100>={<ObjectId:LotType,
LOT_TYPE_ID=100>; modified; [parcelList=>(..); name=>Lot]}
<ObjectId:AuthorizationDocument,
TEMP:000001574DF30161>={<ObjectId:AuthorizationDocument,
TEMP:000001574DF30161>; new;
[dependentEasementDocument=>{<ObjectId:EasementDocument,
TEMP:000000574DF30161>}; recurringFeeCycle=>null;
authorizationDocumentGroupList=>(..); initialFeeCycle=>null;
oldWorkOrderList=>(..); workList=>(..); legalParcelList=>(..)]}
<ObjectId:Parcel, TEMP:000007574DF30161>={<ObjectId:Parcel,
TEMP:000007574DF30161>; new; [legalParcel=>{<ObjectId:LegalParcel,
TEMP:000006574DF30161>}; lotType=>{<ObjectId:LotType,
LOT_TYPE_ID=100>}; tdWorkList=>(..)]}
<ObjectId:EasementDocument,
TEMP:000000574DF30161>={<ObjectId:EasementDocument,
TEMP:000000574DF30161>; new; [grantorList=>(..);
authorizationDocument=>{<ObjectId:AuthorizationDocument,
TEMP:000001574DF30161>}; granteeList=>(..)]}
<ObjectId:FeeCycleType,
FEE_CYCLE_TYPE_ID=101>={<ObjectId:FeeCycleType,
FEE_CYCLE_TYPE_ID=101>; modified; [feeCycleList=>(..); name=>Monthly]}
<ObjectId:Contact, TEMP:000004574DF30161>={<ObjectId:Contact,
TEMP:000004574DF30161>; new; [phoneList=>(..); addressList=>(..);
contactNameList=>(..); tdWorkList=>(..); emailList=>(..);
primaryContactName=>{<ObjectId:ContactName, TEMP:000005574DF30161>}]}

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

Thread [SocketListener0-0] (Suspended (breakpoint at line 95 in
BaseDataObjectImpl))
	Fee(BaseDataObjectImpl).writeObject(ObjectOutputStream) line: 95
	GeneratedMethodAccessor171.invoke(Object, Object[]) line: not available
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.writeObject(Object) line: 278
	HashMap.writeObject(ObjectOutputStream) line: 978
	GeneratedMethodAccessor75.invoke(Object, Object[]) line: not available
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.writeObject(Object) line: 278
	FeeCycle(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
	GeneratedMethodAccessor170.invoke(Object, Object[]) line: not available
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.writeObject(Object) line: 278
	LinkedList.writeObject(ObjectOutputStream) line: 685
	GeneratedMethodAccessor162.invoke(Object, Object[]) line: not available
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.defaultWriteFields(Object, ObjectStreamClass) line: 1332
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1304
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.writeObject(Object) line: 278
	HashMap.writeObject(ObjectOutputStream) line: 978
	GeneratedMethodAccessor75.invoke(Object, Object[]) line: not available
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.writeObject(Object) line: 278
	FeeCycleType(CayenneDataObject).writeObject(ObjectOutputStream) line: 497
	GeneratedMethodAccessor170.invoke(Object, Object[]) line: not available
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.writeObject(Object) line: 278
	HashMap.writeObject(ObjectOutputStream) line: 978
	GeneratedMethodAccessor75.invoke(Object, Object[]) line: not available
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 809
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1296
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.defaultWriteFields(Object, ObjectStreamClass) line: 1332
	ObjectOutputStream.writeSerialData(Object, ObjectStreamClass) line: 1304
	ObjectOutputStream.writeOrdinaryObject(Object, ObjectStreamClass,
boolean) line: 1247
	ObjectOutputStream.writeObject0(Object, boolean) line: 1052
	ObjectOutputStream.defaultWriteFields(Object, ObjectStreamClass) line: 1332
	ObjectOutputStream.defaultWriteObject() line: 367
	DataContext.writeObject(ObjectOutputStream) line: 1740

Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
Yes, that makes more sense to me.  I forgot that
System.identityHashCode(this) was available.

On 7/26/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> +1 with this modification:
>
> public String toString() {
>    return getClass().getName() + "@" + System.identityHashCode(this);
> }
>
>
> On Jul 26, 2006, at 6:57 PM, Mike Kienenberger wrote:
>
> > Here's a proposal for a slightly-better toString() with no side
> > effects:
> >
> >    private int unresolvedHashCode() {
> >        return 15 + objectList.hashCode();
> >    }
> >
> >    public String toString() {
> >        return getClass().getName() + "@" +
> > Integer.toHexString(unresolvedHashCode());
> >    }
> >
> >
> > On 7/26/06, Mike Kienenberger <mk...@gmail.com> wrote:
> >> On 7/26/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> >> > BTW LinkedList is hard to debug as it only shows one element at a
> >> > time, hiding the rest of the chain.
> >>
> >> Another thing that makes debugging ToManyList hard is that it calls
> >> resolvedObjectList() in all of the standard methods.
> >>
> >> I think we want to consider creating a custom toString() method that
> >> shows the object state as-is instead of using the default toString()
> >> which calls hashCode().
> >>
> >
>
>

Re: Deleted objects showing up a serialized data context

Posted by Andrus Adamchik <an...@objectstyle.org>.
+1 with this modification:

public String toString() {
   return getClass().getName() + "@" + System.identityHashCode(this);
}


On Jul 26, 2006, at 6:57 PM, Mike Kienenberger wrote:

> Here's a proposal for a slightly-better toString() with no side  
> effects:
>
>    private int unresolvedHashCode() {
>        return 15 + objectList.hashCode();
>    }
>
>    public String toString() {
>        return getClass().getName() + "@" +
> Integer.toHexString(unresolvedHashCode());
>    }
>
>
> On 7/26/06, Mike Kienenberger <mk...@gmail.com> wrote:
>> On 7/26/06, Andrus Adamchik <an...@objectstyle.org> wrote:
>> > BTW LinkedList is hard to debug as it only shows one element at a
>> > time, hiding the rest of the chain.
>>
>> Another thing that makes debugging ToManyList hard is that it calls
>> resolvedObjectList() in all of the standard methods.
>>
>> I think we want to consider creating a custom toString() method that
>> shows the object state as-is instead of using the default toString()
>> which calls hashCode().
>>
>


Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
Here's a proposal for a slightly-better toString() with no side effects:

    private int unresolvedHashCode() {
        return 15 + objectList.hashCode();
    }

    public String toString() {
        return getClass().getName() + "@" +
Integer.toHexString(unresolvedHashCode());
    }


On 7/26/06, Mike Kienenberger <mk...@gmail.com> wrote:
> On 7/26/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> > BTW LinkedList is hard to debug as it only shows one element at a
> > time, hiding the rest of the chain.
>
> Another thing that makes debugging ToManyList hard is that it calls
> resolvedObjectList() in all of the standard methods.
>
> I think we want to consider creating a custom toString() method that
> shows the object state as-is instead of using the default toString()
> which calls hashCode().
>

Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
On 7/26/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> BTW LinkedList is hard to debug as it only shows one element at a
> time, hiding the rest of the chain.

Another thing that makes debugging ToManyList hard is that it calls
resolvedObjectList() in all of the standard methods.

I think we want to consider creating a custom toString() method that
shows the object state as-is instead of using the default toString()
which calls hashCode().

Re: Deleted objects showing up a serialized data context

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jul 28, 2006, at 1:53 PM, Mike Kienenberger wrote:

> On 7/27/06, Mike Kienenberger <mk...@gmail.com> wrote:
>> On 7/26/06, Mike Kienenberger <mk...@gmail.com> wrote:
>> > And with the changes to ToManyList, I've now been able to see that
>> > removedFromUnresolved contains a reference to my deleted object.
>>
>> I'm now thinking that the solution to this problem is to not add NEW
>> or TRANSIENT objects to the removedFromUnresolved list.   These
>> objects will never be removed from a database fetch list as they  
>> don't
>> exist in the database, so there's no point in keeping a reference to
>> them.
>
> Ok.   I'm starting to second-guess myself.   Are there cases when a
> transient object might be in the database?   What if a committed
> object is unregistered from the DataContext?   Maybe it's not really
> worth worrying about since unregistering objects is pretty rare.

The point is that a transient object is not tracked by Cayenne, so  
keeping it in 'removedFromUnresolved' is wrong as far as I can tell.

Andrus

Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
On 7/27/06, Mike Kienenberger <mk...@gmail.com> wrote:
> On 7/26/06, Mike Kienenberger <mk...@gmail.com> wrote:
> > And with the changes to ToManyList, I've now been able to see that
> > removedFromUnresolved contains a reference to my deleted object.
>
> I'm now thinking that the solution to this problem is to not add NEW
> or TRANSIENT objects to the removedFromUnresolved list.   These
> objects will never be removed from a database fetch list as they don't
> exist in the database, so there's no point in keeping a reference to
> them.

Ok.   I'm starting to second-guess myself.   Are there cases when a
transient object might be in the database?   What if a committed
object is unregistered from the DataContext?   Maybe it's not really
worth worrying about since unregistering objects is pretty rare.

Re: Deleted objects showing up a serialized data context

Posted by Andrus Adamchik <an...@objectstyle.org>.
Good point, I agree.

Could you create a Jira issue and a patch against 1.2 branch  
(unaffected by the current Maven migration), and then port it to HEAD  
when the migration is over?

Also would be nice to create a unit test showing the problem, just to  
make sure that the fix fixes it (Util.cloneViaSerialization can help  
in serialization testing).

Andrus


On Jul 27, 2006, at 1:50 PM, Mike Kienenberger wrote:

> On 7/26/06, Mike Kienenberger <mk...@gmail.com> wrote:
>> And with the changes to ToManyList, I've now been able to see that
>> removedFromUnresolved contains a reference to my deleted object.
>
> I'm now thinking that the solution to this problem is to not add NEW
> or TRANSIENT objects to the removedFromUnresolved list.   These
> objects will never be removed from a database fetch list as they don't
> exist in the database, so there's no point in keeping a reference to
> them.
>
>    boolean removeLocal(Object object) {
>        if (addedToUnresolved != null) {
>            addedToUnresolved.remove(object);
>        }
>
>        if (removedFromUnresolved == null) {
>            removedFromUnresolved = new LinkedList();
>        }
>
>        // No point in adding a new or transient object -- these will
> never be fetched from the database.
>        boolean shouldAddToRemovedFromUnresolvedList = true;
>        if (object instanceof DataObject) {
>            DataObject dataObject = (DataObject) object;
>            if ( (dataObject.getPersistenceState() ==
> PersistenceState.TRANSIENT)
>              || (dataObject.getPersistenceState() ==  
> PersistenceState.NEW) ) {
>                shouldAddToRemovedFromUnresolvedList = false;
>            }
>        }
>
>        if (shouldAddToRemovedFromUnresolvedList) {
>            removedFromUnresolved.addLast(object);
>        }
>
>        // this is really meaningless, since we don't know
>        // if an object was present in the list
>        return true;
>    }
>


Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
On 7/26/06, Mike Kienenberger <mk...@gmail.com> wrote:
> And with the changes to ToManyList, I've now been able to see that
> removedFromUnresolved contains a reference to my deleted object.

I'm now thinking that the solution to this problem is to not add NEW
or TRANSIENT objects to the removedFromUnresolved list.   These
objects will never be removed from a database fetch list as they don't
exist in the database, so there's no point in keeping a reference to
them.

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

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

        // No point in adding a new or transient object -- these will
never be fetched from the database.
        boolean shouldAddToRemovedFromUnresolvedList = true;
        if (object instanceof DataObject) {
            DataObject dataObject = (DataObject) object;
            if ( (dataObject.getPersistenceState() ==
PersistenceState.TRANSIENT)
              || (dataObject.getPersistenceState() == PersistenceState.NEW) ) {
                shouldAddToRemovedFromUnresolvedList = false;
            }
        }

        if (shouldAddToRemovedFromUnresolvedList) {
            removedFromUnresolved.addLast(object);
        }

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

Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
On 7/26/06, Andrus Adamchik <an...@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)

Re: Deleted objects showing up a serialized data context

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jul 26, 2006, at 3:32 PM, Mike Kienenberger wrote:

>
>> BTW LinkedList is hard to debug as it only shows one element at a
>> time, hiding the rest of the chain.
>
> Yeah, I'm not sure if it's obvious, but the LinkedList above contains
> only one element.   At least that's how I'm reading the size=1 plus
> the next/previous/current links all pointing to the same id value.
>
> this= LinkedList  (id=394)
>       header= LinkedList$Entry  (id=641)
>               element= null
>               next= LinkedList$Entry  (id=673)
>                       element= FeeCycle  (id=387)
>                               isInTemporaryDataContext= true
>                               objectContext= null
>                               objectId= null
>                               persistenceState= 1
>                               snapshotVersion= 0
>                               values= HashMap  (id=375)
>                       next= LinkedList$Entry  (id=641)
>                       previous= LinkedList$Entry  (id=641)
>               previous= LinkedList$Entry  (id=673)
>       modCount= 1
>       size= 1

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.

Andrus

Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
On 7/26/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> That's fine. I am talking about FeeCycle -> FeeCycleType delete rule
> - this one should be nullify.

Yes, this one is already set to nullify.

> My suggestion was made on a premise that FeeCycleType.feeCycleList
> actually contains feecycles. Could you doublecheck that?

In my particular test case above, there are no permanent FeeCycles --
I deleted them all in order to rule out the influence of bad data.
So there aren't any FeeCycles.


> BTW LinkedList is hard to debug as it only shows one element at a
> time, hiding the rest of the chain.

Yeah, I'm not sure if it's obvious, but the LinkedList above contains
only one element.   At least that's how I'm reading the size=1 plus
the next/previous/current links all pointing to the same id value.

this= LinkedList  (id=394)
       header= LinkedList$Entry  (id=641)
               element= null
               next= LinkedList$Entry  (id=673)
                       element= FeeCycle  (id=387)
                               isInTemporaryDataContext= true
                               objectContext= null
                               objectId= null
                               persistenceState= 1
                               snapshotVersion= 0
                               values= HashMap  (id=375)
                       next= LinkedList$Entry  (id=641)
                       previous= LinkedList$Entry  (id=641)
               previous= LinkedList$Entry  (id=673)
       modCount= 1
       size= 1

Re: Deleted objects showing up a serialized data context

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jul 26, 2006, at 3:21 PM, Mike Kienenberger wrote:
> I have it set as Deny instead of Nullify (I don't want to allow
> deleting a FeeCycleType unless all FeeCycles pointing to it are
> deleted).

That's fine. I am talking about FeeCycle -> FeeCycleType delete rule  
- this one should be nullify.


> I'll go ahead and try setting it to nullify, but I'm still confused
> how the serialization process is finding the deleted FeeCycles when
> the FeeCycleType doesn't appear to have any references to it.

My suggestion was made on a premise that FeeCycleType.feeCycleList  
actually contains feecycles. Could you doublecheck that?

BTW LinkedList is hard to debug as it only shows one element at a  
time, hiding the rest of the chain.

Andrus


Re: Deleted objects showing up a serialized data context

Posted by Mike Kienenberger <mk...@gmail.com>.
I have it set as Deny instead of Nullify (I don't want to allow
deleting a FeeCycleType unless all FeeCycles pointing to it are
deleted).

I'll go ahead and try setting it to nullify, but I'm still confused
how the serialization process is finding the deleted FeeCycles when
the FeeCycleType doesn't appear to have any references to it.


On 7/26/06, Andrus Adamchik <an...@objectstyle.org> wrote:
>
> On Jul 25, 2006, at 9:24 PM, Mike Kienenberger wrote:
>
> > In my testing, I submit a web request that creates a new object,
> > submit a web request which creates another set of new objects and
> > assign it to relationships with my first new object, then submit a web
> > request which deletes the set of new objects.
>
> Mike, just a guess. Looks like the reverse relationship of
> FeeCycleType.feeCycleList doesn't have nullify delete rule. So you
> can either set such delete rule, or manually break relationship after
> delete. This explanation looks too simple, but all the symptoms point
> to it.
>
> Andrus
>
>

Re: Deleted objects showing up a serialized data context

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jul 25, 2006, at 9:24 PM, Mike Kienenberger wrote:

> In my testing, I submit a web request that creates a new object,
> submit a web request which creates another set of new objects and
> assign it to relationships with my first new object, then submit a web
> request which deletes the set of new objects.

Mike, just a guess. Looks like the reverse relationship of  
FeeCycleType.feeCycleList doesn't have nullify delete rule. So you  
can either set such delete rule, or manually break relationship after  
delete. This explanation looks too simple, but all the symptoms point  
to it.

Andrus