sorry to butt in, just thought i'd give you my £0.02...
sounds to me you need inheritance, the problem being that relational db's
know nada about oo... right?
you could have a structure like this:
category[
category_id pk
name string]
animal[
animal_id pk
category fk
.. animal stuff...]
canine[
animal fk
supercategory fk
...canine stuff..]
dog[
animal fk
supercategory fk
...dog stuff..]
then have a finder method that looks up the animal by pk, gets the
category name (which will be something like 'dog', 'fish') and uses that
to construct a query on the table with the same name.
so in 'category', 'name' will be the reference to what table to do the
real lookup in, then use that table's animal_fk.
obviously you'll have to create an 'animal' row for each 'dog' etc.
and for full inheritance mapped to the db there'd also be a 'canine',
'mammal'... be pretty hard to do do with bmp..!
if your dba needs to be able to verify referential integrity (why?) they
won't like you doing this - don't think you can write a lookup like that
in pure ANSI sql! :>
i'd probably have create-methods on the animal/dog etc beans that take a
Category arg and a pk, to make the finder neater. or use a Factory
pattern.
advantage -> a very flexible data structure, and that lookups will always
be on pk (no more lookups than the object has parent categories).
/m
ps sorry i won't score many points for technobabble - i'll try harder next
time :>
On Sat, 17 Feb 2001, Peter Routtier-Wone wrote:
> Zillions of brownie points to David Jencks for hitting the nail squarely on
> the head and even more points for using all the right technobabble. If David
> doesn't mind I shall take this into a private discussion with him.
>
> My thanks to everyone who tried to help in this list.
>
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> List Help?: [EMAIL PROTECTED]
>
>
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]