Re: Stopping EOEntityClassDescription.validateObjectForSave from tripping relationships
Re: Stopping EOEntityClassDescription.validateObjectForSave from tripping relationships
- Subject: Re: Stopping EOEntityClassDescription.validateObjectForSave from tripping relationships
- From: Chuck Hill <email@hidden>
- Date: Thu, 2 Apr 2009 16:16:12 -0700
On Apr 2, 2009, at 2:27 PM, Jeffrey Simpson wrote:
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.
I think you would also need to replace the current implementation of
validateForSave. I agree that this is 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.
It is worth filing a bug on, there is probably no need to validate a
value that is the same as the snapshot. Maybe an optimization can be
implemented.
Chuck
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.
--
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