I have some tables that use a joined inheritance strategy. So the Subclass table points at the Base table via a foreign key that is itself that Subclass table's primary key.
Now I have a many-to-many join table that [i]logically[/i] references a subclass record (that is, a Subclass may have many Foos, and a Foo may have many Subclasses.
I've noticed in this case that the foreign key that gets generated for the join table references the [i]Base[/i] table. This makes some sense, in that hey, you have to start with the Base table anyway in order to pull back any meaningful Java objects, but it is incorrect (I think) with respect to the data model. That is, it is [i]not[/i] the case that a Foo may be joined with any old Base record--a Foo must be joined with a Subclass record.
A more realistic (though still invented) example: Suppose I have a Person table that "extends" a Party table. And now suppose I have a join table that relates a Person to his Addresses. The foreign keys that are installed on the join table by Toplink make it point to a Party record, not a Person record. But this is incorrect; the table is designed to relate Addrresses to [i]Person[/i] records, not [i]Party[/i] records.
Is this correct behavior?
Laird
[Message sent by forum member 'ljnelson' (ljnelson)]
http://forums.java.net/jive/thread.jspa?messageID=215772