• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Dealing with relationships and inheritance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dealing with relationships and inheritance


  • Subject: Dealing with relationships and inheritance
  • From: Charles Koppelman <email@hidden>
  • Date: Thu, 07 Feb 2008 15:32:09 -0500
  • Thread-topic: Dealing with relationships and inheritance

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?

Thanks, and happy Year of the Rat!

Charles Koppelman
Programmer
Youth For Understanding, USA

 _______________________________________________
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

  • Follow-Ups:
    • Re: Dealing with relationships and inheritance
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Serializing collections
  • Next by Date: Re: Dealing with relationships and inheritance
  • Previous by thread: Re: Serializing collections
  • Next by thread: Re: Dealing with relationships and inheritance
  • Index(es):
    • Date
    • Thread