cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Baldwin <jfbald...@earthlink.net>
Subject Re: Exception Deleting DataObject with to-many relationship
Date Fri, 27 Nov 2009 15:29:59 GMT
Michael,


> Is childList the same as salesOrderList?

Sorry, I am not sure what you mean by "the same".

If you are asking is the entity self-referential, then the answer is no.  The parent is named
"SalesOrder" and the child is "OrderItem". It is a simple "to-many" relationship (one sales-order
to many order-items).

More info:
I did some more testing and found that the problem is associated with older SalesOrders stored
in the production server and seems to be creating an Exception on

	objectContext.deleteObjects(salesOrder.getOrderItemList())

However, when I create a SalesOrder with new data, I cannot duplicate the Exception condition.
So perhaps the Exception is somehow associated with the older data.

Also, I wrote my own "deleteObjects" method (for debugging purposes) and it appears to work
fine with the new SalesOrders or seemingly as well the ObjectContext version and generated
the same Exception with the older data.

The complication with debugging this issue is that the data is on the production server and
once I attempt a test (even though it claims that it failed) the data is actually deleted,
so I can't duplicate the test once all the data is deleted.

Thanks,
Joe



On Nov 27, 2009, at 10:03 AM, Michael Gentry wrote:

> Is childList the same as salesOrderList?
> 
> 
> On Thu, Nov 26, 2009 at 6:29 PM, Joe Baldwin <jfbaldwin@earthlink.net> wrote:
>> I am getting an odd exception when I attempt to delete a DataObject with a "to-many"
(aka child list).
>> 
>> Here is the pseudo code:
>> 
>> 1. deleteObjects(parent.getChildList())
>> 2. deleteObject(parent)
>> 3. objectContext.commitChanges()
>> 
>> on Exception
>>        objectcontext.rollbackChanges()
>> 
>> 
>> It is very odd but I am getting the following error:
>> 
>> org.apache.cayenne.reflect.PropertyException:
>> [v.3.0B1 Nov 03 2009 19:16:06]
>> Error unsetting to-many DataObject property: salesOrderList
>> 
>> But it is deleting all the associated database rows.
>> 
>> Am I missing a step in the delete procedure?
>> 
>> thanks,
>> Joe
>> 
>> 


Mime
View raw message