I have a rather simple (I think) class that I want to map:
<class name="parent" table="PARENT_TABLE">
<composite-id>
<key-property name = "a" column = "A"/>
<key-property name = "b" column = "B"/>
<key-property name = "c" column = "C"/>
</composite-id>
<map name = "theMap" table = "PARENT_TABLE" where="type='access'">
<key foreign-key = "PARENT_TABLE_FK">
<column name = "A"/>
<column name = "B"/>
<column name = "C"/>
</key>
<map-key column = "X" type = "double"/>
<element column = "Y" type = "double" not-null="true"/>
</map>
</class>
I got the where="type='access'" trick from mapping multiple sets in one table in hibernate, but the problem is that with the map, the foreign key (A,B,C,X) isn’t lining up with the parent table (A,B,C).
Does anyone have any idea how to get this happy? The PARENT_TABLE would be completely redundant if I have to map the map separately.
it is not pretty and also renders Schemaexport useless but to get it work you need to specify a where condition to make the parent unique, set insert/update to false and let the map persist the parent indirectly.