Re: Can't delete parent
Re: Can't delete parent
- Subject: Re: Can't delete parent
- From: "Ricardo J. Parada" <email@hidden>
- Date: Thu, 25 Mar 2010 20:39:32 -0400
Thanks Chuck... I tried that but it was still getting the error.
It turns out that there was something else going... The Foo entity had another to-one relationship pointing to some other entity and was setup to nullify and the problem was the set method for that to-one had some logic in there checking for null and then calling deleteAllItemsRelationship() where "items" is the to-many I was concerned about.
After fixing those it seems like it's back to working... Thanks.
On Mar 25, 2010, at 8:08 PM, Chuck Hill wrote:
>
> On Mar 25, 2010, at 4:34 PM, Ricardo J. Parada wrote:
>
>> Hi All,
>>
>> I have a couple of entities setup like this:
>>
>> Foo <-->> FooItem
>>
>> The "items" to-many has owns destination checked and a delete rule of cascade. Then the "foo" to-one in the FooItem entity that points back to the parent is set to nullify.
>
> Use No Action, not Nullify.
>
>
> Chuck
>
>>
>> Why then when I do this:
>>
>> aFoo.delete();
>> ec.saveChanges();
>>
>> I get a a validation exception like this:
>>
>> ERXValidationException: A <b>Foo Item</b> must have a <b>Foo</b>.
>> at com.webobjects.eoaccess.EORelationship.validateValue(EORelationship.java:1860)
>> at com.webobjects.eoaccess.EOEntityClassDescription.validateValueForKey(EOEntityClassDescription.java:456)
>> at er.extensions.eof.ERXEntityClassDescription.validateValueForKey(ERXEntityClassDescription.java:814)
>> at com.webobjects.eocontrol.EOCustomObject.validateValueForKey(EOCustomObject.java:1311)
>> at er.extensions.eof.ERXGenericRecord.validateValueForKey(ERXGenericRecord.java:1248)
>> at com.webobjects.eocontrol.EOCustomObject.validateForSave(EOCustomObject.java:1381)
>> at er.extensions.eof.ERXGenericRecord.validateForSave(ERXGenericRecord.java:1299)
>> at com.webobjects.eocontrol.EOCustomObject.validateForUpdate(EOCustomObject.java:1446)
>> at er.extensions.eof.ERXGenericRecord.validateForUpdate(ERXGenericRecord.java:1338)
>> at com.webobjects.eocontrol.EOEditingContext.validateTable(EOEditingContext.java:2271)
>> at com.webobjects.eocontrol.EOEditingContext.validateChangesForSave(EOEditingContext.java:3020)
>> at com.webobjects.eocontrol.EOEditingContext._prepareForPushChanges(EOEditingContext.java:3249)
>> at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3179)
>> at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1085)
>> at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1007)
>> at com.mpv.webcomponents.MPVWOComponent.saveChanges(MPVWOComponent.java:233)
>> at com.mpv.reportcomponents.ReportPublishDelete.delete(ReportPublishDelete.java:80)
>> ... skipped 83 stack elements
>>
>> these are some objects I converted recently to use the eo gap generation pattern. I'm looking through my code and I can't yet find anything that would cause this. The entities seem to be setup right. But things are just not behaving as expected.
>>
>> Any ideas where to look?
>>
>>
>> Thanks
>> Ricardo
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden