Re: Create Entity, Delete Entity, Why does validation occur?
Re: Create Entity, Delete Entity, Why does validation occur?
- Subject: Re: Create Entity, Delete Entity, Why does validation occur?
- From: Chuck Hill <email@hidden>
- Date: Mon, 21 Jun 2010 15:38:24 -0700
Quoting from the same link below:
> If you override any of these operation-specific validation methods, be sure to invoke the super implementation. This is important, as the default implementations of the validateFor... methods pass the check on to the object's EOClassDescription, which performs basic checking among properties, including invokingvalidateValueForKey for each property. The EOAccess layer's EOEntityClassDescription class verifies constraints based on an EOModel, such as delete rules. For example, the delete rule for a Department object might state that it can't be deleted if it still contains Employee objects.
On Jun 21, 2010, at 3:31 PM, James Cicenia wrote:
> It does save the delete. And, the docs don't say anything about on delete unless someone adds their own overrides etc.
>
> I don't see any, but then again, I am new to this particular model. I will have to talk to the other developers about it.
>
> thanks
>
> On Jun 21, 2010, at 5:12 PM, Chuck Hill wrote:
>
>>
>> On Jun 21, 2010, at 2:10 PM, James Cicenia wrote:
>>
>>> Hello -
>>>
>>> I am doing this:
>>>
>>> if(att1.alertTarget()==null || att1.percentageOfAlert() == null ){
>>> currentMasterAlert.removeFromAlertThresholdTargetsRelationship(att1);
>>> currentMasterAlert.ctEditingContext().deleteObject(att1);
>>> att1 = null;
>>> }
>>>
>>>
>>> but get this:
>>>
>>> [2010-6-21 16:4:50 CDT] <WorkerThread8> Validation failed on an object [null] with keypath = att3.alertTarget and exception: The alertTarget property of AlertThresholdTarget must have a AlertTarget assigned
>>
>> You probably don't need the removeFromAlertThresholdTargetsRelationship, the model is probably doing that for you.
>>
>>
>>> Yet it does delete the entity:
>>
>> Does it save the delete?
>>
>>
>>> Why does it want to run validation during a delete?
>>
>> Validating Before an Operation
>> The EOValidation methods -- validateForInsert, validateForUpdate, validateForSave, and validateForDelete -- validate an entire object to see if it's valid for a particular operation. These methods are invoked automatically by the Enterprise Objects Framework when the associated operation is initiated.
>>
>> http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/com/webobjects/eocontrol/EOValidation.html
>>
>>
>> Chuck
>>
>>
>> --
>> 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
--
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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