Here's the data I'm trying to map:
Code:
Table 1 has a composite primary key (ID1, ID2) and a foreign key to Table 2
ID1 ID2 FK
---- ---- ----
1111 1234 5555
1111 5678 NULL
2222 1234 NULL
2222 5678 NULL
Table 2 is just a header table that lists valid IDs
ID
----
4444
5555
6666
Table 3 contains that data that I want to retrieve
ID5 Value
---- -------
4444 TEST1
4444 TEST2
5555 TEST3
5555 TEST4
(ID5 is a foreign key to Table 2 as well)
So for '5555', I want to retrieve a Set containing 'TEST3' and 'TEST4'
What would be the proper way to map this?
I tried the following:
Code:
File 1:
<class name="Class1" table="SomeTable">
<composite-id name="id" class="SomeKeyClass">
<key-property name="a" type="string" />
<key-property name="b" />
</composite-id>
<property name="refID" type="string" />
<set name="someSet" lazy="false">
<key column="columnID" property-ref="refID" />
<one-to-many class="EntryInfo" />
</set>
</class>
File 2:
<class name="EntryInfo" table="ThirdTable">
<composite-id name="id" class="SomeOtherKeyClass">
<key-property name="refID" type="string" />
<key-property name="y" type="string" />
</composite-id>
<property name="z" />
</class>