You are here: Re: One-to-many with a twist « MsSQL Server « IT news, forums, messages
Re: One-to-many with a twist

Posted by Erland Sommarskog on 09/30/05 11:17

(martind-crap1@mailblocks.com) writes:
> Thanks for the input, guys! I'm looking to go for maximum flexibility
> without having to abandon 1-to-n in favor of n-to-m, so here's another
> option I'm contemplating: What if I include a discriminator in
> Employee that specifies whether the parent_id references an Agency or a
> Publisher? Foreign key constraints are no longer possible, but hey,
> can't have it all...

Discriminants? Toto, you are not in Kansas anymore. In a relational
database, discriminants are virtually unheard of, but referential
integrity is essential.

> One specific case are Address objects, which I want to back-link to
> their respective owners (Agents, Publishers, Customers, Suppliers, etc.
> all have addresses, and I can't find a good superclass that won't screw
> up my ORM).

That's probably because it would be the wrong way to go. An agent,
publisher, customer etc could have an address, and each such table
would include an addressid. But the address would be blind to from
where it is referred.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация