mojo_jojo wrote:
Hi, I'm mapping my old (and poorly structured) database in hibernate. I have one table called Account, another called Fund, and a third called Balance.
Balance says how much money an account has in a given fund. So Account has a one-to-many relationship to Balance. Fund also has a one-to-many relationship to Balance.
So here's where it gets messy. Balance doesn't have a proper primary key. It has a foreign key to each of the two tables it is connected to. The two foriegn keys form a composite key on the table.
Oh, and the name of the foreign key to Fund is not the same name as the primary key on fund, but it holds the same data.
What is the proper way to write the mapping file?
Thank you in advance.
You could use a composite key with a key-many-to-one mapping.
Farzad-