Hello,
I am trying to map a lookup table (a table with three columns, each a FK to other tables) to a Test class using Hibernate. The columns are:
TestTypeID
TestCategoryID
QuestionID
There can be multiple QuestionID entries for identical combinations of TestTypeID and TestCategoryID. There will be a unique combination of all three in the record at one time.
I want to be able to instantiate a Test class that has attributes of TestTypeID and TestCategoryID; it also will have a Collection of Questions created from the QuestionID.
Hibernate requires me to specifiy a PK in each mapped class. This means I need to use all three lookup-table columns as the composite-key in the Test class. However, when I create the Set in the Test map, I am required to use the composite key to link to the QuestionID field in the Question table. I cannot do this, as the relationship between the Question and Lookup table is via QuestionID.
So am at an impasse. I am too new to Hibernate (and not clever enough) to think of a solution. Has anyone needed to handle lookup tables in a similar way? If so, what kind of mapping strategy did you use?
Hope this made sense. I can post more specifics if necessary.
--Bill
|