Hallo,
I have the following situation:
table1{a:String PK, b:string, c:string}
table2{a:string PK, b:string PK, c:string}
What I need ist an association like this:
table1.b = table2.b
When you look at it unidirectional, it is a one-to-may relationship.
What is my problem?
I don't know how to tell hibernate, that it should use the column b in table1 for the join. As far as my experience goes, hibernte always uses the primary key.
At the moment I use this:
<bag name="historicalDates" table="table2" >
<key column="b"/>
<one-to-many class="table2" />
</bag>
That is a join table1.a = table2.b and that's not what I need.
If I would use a many-to-many associoation, I would need a mapping table, right?
I am sure I am not the only one who want's to make a join like this, although it means not to have a perfect data model.
Thank you for any help!
|