Hi. I can't because normal <map> would need a <key> - that's column in the Tab2 that refers to pk in Tab1 (that's "id"). Here's example of that tables:
Code:
tab1:
| id | map1 | map2 | map3 |
+----+------+------+------+
| 1 | 1 | 2 | 3 |
| 2 | 4 | 5 | 6 |
...
tab2:
| id1 | id2 | value |
+-----+-----+--------+
| 1 | x | value1 |
| 1 | y | value2 |
| 2 | x | value3 |
| 2 | y | value4 |
| 3 | x | value5 |
| 3 | y | value6 |
| 4 | x | value7 |
| 4 | y | value8 |
| 5 | x | value9 |
| 5 | y | valueA |
| 6 | x | valueB |
| 6 | y | valueC |
...
I'd like to have in Java (JavaScript notation):
Code:
tab1_line1 = /*Tab1 object*/{ id: 1, map1: /*java.util.Map*/{ x: value1, y: value2 }, map2: { x: value3, y: value4 }, map3: { x: value5, y: value6 } };
tab1_line2 = /*Tab1 object*/{ id: 2, map1: { x: value7, y: value8 }, map2: { x: value9, y: value10 }, map3: { x: value11, y: value12 } };
...
What sohould the mapping look like?
Code:
<class name="Tab1" table="tab1">
<id column="id" name="id">
<generator class="native"/>
</id>
<map name="map1">
<one-to-many class="Tab2" />
??? - using <key> needs aditional column creation in tab2
</map>
<map name="map2">
<one-to-many class="Tab2" />
??? - using <key> needs aditional column creation in tab2
</map>
<map name="map3">
<one-to-many class="Tab2" />
??? - using <key> needs aditional column creation in tab2
</map>
</class>
<class name="Tab2" table="tab2">
<composite-id>
<key-property name="id1" column="id1" />
<key-many-to-one name="id2" class="Tab3" column="id3"/>
</composite-id>
<property name="value" column="value" />
</class>
Thanks in advance. I really apreciate your help!