I have to objects to map as one-to-many and many-to-one bidirectional relationship.
Both of them have composite id as an identifier.
The first one, "Template" contains a set of "Groups", which is the other one.
The Template.java looks like this:
Code:
...
private Set groups;
...
//getter/setter methods here
...
So in the Template.hbm.xml I have
Code:
<set name="groups">
<key>
<column name="TMPL_ID"/>
<column name="TMPL_VER"/>
</key>
<one-to-many class="Group"/>
</set>
I hope that this is correct.
The Group.java looks like this:
Code:
...
private Template template;;
...
//getter/setter methods here
...
Now I have a problem mapping many-to-one relationship from Group to Template?
How do I go, with two many-to-one statements with the same class="" value, same name="" values, just the column="" different, or do I do it differently.
Please help.