Hi,
I have a class which contains a java.util.Map. The Map's keys are Strings, and the values are a List of classes. The docs say that you can't map a collection to a collection, so I was wondering if there was any way to map this, as it seems like it would be a fairly common use case. The child objects in this case are completely dependent on the parent objects.
Here's an example of what I'd like to do:
<class...>
<map name="categories"
table="categories"
lazy="false"
inverse="false"
cascade="all-delete-orphan"
order-by="category_order">
<key
column="PROJECT_ID">
</key>
<map-key column="role_cat_id" type="string"/>
<!--a list here is not allowed -->
<list name="map-values" table="map-values" lazy="true" inverse="false" cascade="all-delete-orphan">
<key column="PROJECT_ID"/>
<list-index column="ITEM_ORDER"/>
<composite-element
class="my.value.class">
<property
name="text"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="TEXT"/>
...
</composite-element>
</list>
</map>
</class>
Any ideas? If I did a one-to-many with a new List class, how would I map that? Any help greatly appreciated.
--Jason
|