On my current project I have to map old -badly designed- legacy tables. I want to use the subclass-join map pattern, but I have the following problem:
The parent class has a column contaning the table-name that contains additional child information (the ideal candidate for the discriminator value-currently there are 5 different child tables). The child class has no reference to the parent class, but the parent has a additional column containing the primary key to the child table (which is not really a foreign key for the database because the exact table holding the key is defined by the discriminator). Basically what I need is the ability to define the column of the parent table that will be used to join with the child table (Hibernate uses the pk of the parent table and it seems that this can not be configured). I know I can define the key of the child table table that is used for the join using <key> in the <join> element, but that is not enough for this rare case where a different column as the pk in the parent table is the reference to the child table. Also I can't make the association many-to-one because I don't know the child table (Or is there a many-to-one/discriminator functionality that I don't know of). Any help is appreciated.
Rgds,
Okke Harsta
Last edited by oharsta on Fri May 26, 2006 4:32 pm, edited 4 times in total.
|