Re: Dealing with relationships and inheritance
Re: Dealing with relationships and inheritance
- Subject: Re: Dealing with relationships and inheritance
- From: Chuck Hill <email@hidden>
- Date: Thu, 7 Feb 2008 13:02:32 -0800
On Feb 7, 2008, at 12:32 PM, Charles Koppelman wrote:
We've been using single-table inheritance here for quite a while.
Let's start with an example:
A person can send an email or fax. They share plenty of fields and
plenty
of methods, but there is a bit of divergence.
So we have something like...
Person ->> Message where Message can be either EmailMessage
(MESSAGE_TYPE 1)
or FaxMessage (2).
I notice that when this method is traversed, it creates two SQL
statements
for each Message like:
SELECT ... FROM MESSAGE WHERE MESSAGE_ID = 1234 AND MESSAGE_TYPE = 1;
SELECT ... FROM MESSAGE WHERE MESSAGE_ID = 1234 AND MESSAGE_TYPE = 2;
Is this the default behavior? If so, then it seems a bit of a
waste to me -
why not say, either...WHERE MESSAGE_ID = 1234; or ...WHERE
MESSAGE_ID = 1234
AND MESSAGE_TYPE in (1, 2);
By creating worthless calls that will return 0 records, we're
needlessly
slowing our app.
Any advice?
That it the way it is. I don't know how easy it would be to optimize
these. EOF might expect there to be only a single entity per result
set.
Chuck
--
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