Hibernate映射有关问题请问

Hibernate映射问题请教
hibernate 映射中  
一个父类 
一个子类  
父类中有多个集合,都指向同一个子类 
在子类中有一个type来区分数据是属于哪一个集合的
该怎么配置xml?

以下是现有的配置,希望大家给点帮助.谢谢各位!

// 父类对象
public class GMBoxItem extends AbstractBoxItem{
	private Set<GMBoxItemRef> userIds = new HashSet<GMBoxItemRef>();
	private Set<GMBoxItemRef> roleIds = new HashSet<GMBoxItemRef>();
	private Set<GMBoxItemRef> deptIds = new HashSet<GMBoxItemRef>();
	private Set<GMBoxItemRef> readIds = new HashSet<GMBoxItemRef>();

        ...
}


// 子类对象
public class GMBoxItemRef implements Persistable{
	// 需要接收的ID
	public static final int TYPE_USER_ID = 0;
	public static final int TYPE_ROLE_ID = 1;
	public static final int TYPE_DEPT_ID = 2;
	// 已读用户的ID
	public static final int TYPE_READED_ID = 9;
	
	private String id;
	private GMBoxItem boxItem;
	private int type; // 区分属性
	private String idV;
	...
}


当前xml文件:
父的
<hibernate-mapping>
    <class name="com.hnjk.notifier.domain.GMBoxItem" table="gm_box_item">
        <id name="id" type="java.lang.String">
            <column name="id"/>
            <generator class="uuid.hex" />
        </id>
        <property name="msgId" type="java.lang.String">
            <column name="msg_id"/>
        </property>
        <property name="available" type="java.lang.Integer">
            <column name="available" />
        </property>
        
        <set name="userIds" cascade="all-delete-orphan" inverse="true">
            <key column="box_item_id" />
            <element>
            <one-to-many class="com.hnjk.notifier.domain.GMBoxItemRef"/>
        </set>
        
        <set name="roleIds" cascade="all-delete-orphan" inverse="true">
            <key column="box_item_id" />
            <one-to-many class="com.hnjk.notifier.domain.GMBoxItemRef"/>
        </set>
        
        <set name="deptIds" cascade="all-delete-orphan" inverse="true">
            <key column="box_item_id" />
            <one-to-many class="com.hnjk.notifier.domain.GMBoxItemRef"/>
        </set>
        
        <set name="readIds" cascade="all-delete-orphan" inverse="true">
            <key column="box_item_id" />
            <one-to-many class="com.hnjk.notifier.domain.GMBoxItemRef"/>
        </set>
    </class>
</hibernate-mapping>



子的
<hibernate-mapping>
    <class name="com.hnjk.notifier.domain.GMBoxItemRef" table="gm_box_item_ref">
        <id name="id" type="java.lang.String">
            <column name="id"/>
            <generator class="uuid.hex" />
        </id>
        <property name="type" type="java.lang.Integer">
            <column name="type" />
        </property>
        <property name="idV" type="java.lang.String">
            <column name="id_v"/>
        </property>
        
        <many-to-one name="boxItem" class="com.hnjk.notifier.domain.GMBoxItem" column="box_item_id" lazy="proxy" cascade="save-update"/>
    </class>
</hibernate-mapping>
1 楼 dkload 2010-06-03  
暂时解决方案是 红色部分 增加条件
#  <set name="userIds" cascade="all-delete-orphan" inverse="true" [color=red]where="type=0"[/color]>  
#             <key column="box_item_id" />  
#             <element>  
#             <one-to-many class="com.hnjk.notifier.domain.GMBoxItemRef"/>  
#         </set>