By the way, the only way I could figure out how to do it is this:
Code:
<hibernate-mapping>
<class name="Item" table="items">
<id name="id" column="item_id" />
<many-to-one name="group" column="group_id" />
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="Group">
<subselect>select distinct group_id from items</subselect>
<id name="id" column="group_id"/>
<set name="children" >
<key column="group_id"/>
<one-to-many class="Item"/>
</set>
</class>
</hibernate-mapping>
I was just wondering if there is a more elegant way to do this, i.e. without the subselect.