I was looking at our schema last night and this morning, and noticed something that might not map well in Hibernate.
It will probably be easiest to give an example.
Lets say we have a main table called "main_table". There are a couple of foreign keys from two lookup-tables in main_table (lets call them "lookup_one" and "lookup_two"). Both lookup-tables have composite primary keys comprised of an ID and a language_id.
table lookup_one:
lookup_one_id
language_id
lookup_one_description
table lookup_two:
lookup_two_id
language_id
lookup_two_description
main_table:
main_table_id
lookup_one_id
language_id
lookup_two_id
As you can see, language_id only shows up once, even though it is part of the primary-key for the two lookup tables. Oracle lets you do this, and there are some advantages; you want all data in the main table to have the same language.
In order to model this in Hibernate, it would seem to me that you would want to create a primary-key class for each lookup, and it would have the two primary key items.
So now you have two classes inside the main_table class (one for each foreign-key back to the lookup tables), and each class has it's own language id.
We have this all throughout our schema; I didn't design it, and we can't change it without spending 6 months of development time, which will not happen, so please don't respond, "Change your schema".
Is this going to be a major stumbling block?
Thanks,
David
|