|
Posted by Erland Sommarskog on 10/01/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]
|