Re: Stopping EOEntityClassDescription.validateObjectForSave from tripping relationships
Re: Stopping EOEntityClassDescription.validateObjectForSave from tripping relationships
- Subject: Re: Stopping EOEntityClassDescription.validateObjectForSave from tripping relationships
- From: Jeffrey Simpson <email@hidden>
- Date: Thu, 02 Apr 2009 17:27:43 -0400
- Thread-topic: Stopping EOEntityClassDescription.validateObjectForSave from tripping relationships
Thanks for the quick reply.
Your right about not modeling the expensive relationships.
I have done some debugging of the whole validateObjectForSave it looks like
it is called for every relationship whether it is mandatory or not.
Overriding validateValueForKey would not help since the query has been made
before it is called, it needs to send in the value. It looks like if I want
to stop this I would have to sub class EOEntityClassDescription. I think
this would be fraught with danger.
The annoying thing is that the default implementation passes the value into
EORelationship and it checks to see if the relationship is mandatory and if
it is not it does nothing.
On 4/2/09 2:05 PM, "Chuck Hill" <email@hidden> wrote:
>
> On Apr 2, 2009, at 7:20 AM, Jeffrey Simpson wrote:
>
>> When a EO object is saved
>> EOEntityClassDescription.validateObjectForSave
>> will be called on it. This method goes over all the classes
>> properties and
>> relationships where it calls validateValueForKey.
>>
>> Is there a way to stop EOEntityClassDescription from validating
>> relationships? When it validates a relationship it causes a select to
>> happen. We noticed this because we have a couple of expensive
>> relationships
>> select wise. It is also kind wasteful to have 5 or 6 selects fire
>> because
>> you changes a single property.
>
>
> It needs to ensure that the object is valid. These are probably
> mandatory relationships and it is verifying there are members. You
> could try implementing
> public Object validateValueForKey(Object value, String key)
> to not call super for these keys if you think there is no reason to do
> so.
>
> A probably better option is to NOT model these relationships, and just
> fetch / manage them as needed.
>
> Chuck
Jeffrey Simpson
Youth For Understanding USA
email@hidden
Telephone: (240) 235-2114
FAX: (202) 235-2104
Preparing young people for their responsibilities and opportunities in a
changing, interdependent world.
_______________________________________________
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