Hello,
I have a composite element TECHNOLOGY in another object ITEM. The mapping is defined as below : <hibernate-mapping>
<class name="com.st.ict.qs.pcms.businessbean.Item" table="T_ITEM"> <id name="internalId" type="integer" column="ITEM_ID"> <generator class="identity"/> </id>
<bag name="itemTechnology" table="T_TECHNOLOGY" lazy="true" cascade="all-delete-orphan" batch-size="20" > <key column="PARENT__ID"> </key> <composite-element class="com.st.ict.qs.pcms.businessbean.ItemTechnology"> <property name="description" type="java.lang.String" update="true" insert="true" column="DESCRIPTION" length="200" /> <property name="type" type="java.lang.String" update="true" insert="true" column="TYPE" length="50" /> </composite-element> </bag>
</class> </hibernate-mapping>
Now this TECHNOLOGY class is also added as composite element in another object PCP.
<hibernate-mapping>
<class name="com.st.ict.qs.pcms.businessbean.Pcp" table="T_PCP"> <id name="internalId" type="int" column="PCP_ID" > <generator class="assigned"/> </id> <bag name="pcpTechnology" table="T_TECHNOLOGY" lazy="true" cascade="all" batch-size="20" > <key column="PARENT__ID"> </key> <composite-element class="com.st.ict.qs.pcms.businessbean.PcpTechnology"> <property name="description" type="java.lang.String" update="true" insert="true" column="DESCRIPTION" length="200" /> <property name="type" type="java.lang.String" update="true" insert="true" column="TYPE" length="50" /> </composite-element> </bag>
</class> </hibernate-mapping>
The table to store the data of TECHNOLOGY is same and they use same PARENT__ID column to store the parent id. and i maintain an attribute in TECHNOLOGY table which will give me the type of technology(values are ITEM or PCP)
Now the issue is, that when i load ITEM theTECHNOLOGY that are linked to PCP are also loaded and i have not defined anywhere the only the technology of type ITEM should be loaded.
So i want to define some discrimator for this mapping.
Thanks to help.
|