Wish i could edit the post! here with code tag!
SORRY, my bad! copied some thing worong
Here is the child mapping
Code:
<hibernate-mapping package="com.inventory.vo">
<class name="WSRateplanVO" table="RATE_PLAN_INFO" lazy="false">
<composite-id>
<key-many-to-one name="wholesalerVO" class="WholesalerVO">
<column name="WHLSLR_ID"/>
</key-many-to-one>
<key-property name="classCode" column="RATE_PLAN_CLASS_CD" type="string"/>
<key-property name="rateplanId" column="RATE_PLAN_CD" type="string"/>
</composite-id>
</class>
</hibernate-mapping>
CODE:
Code:
// main call
boolean r = createWholesalerAll(createWholesalerVO());
// create parent
private WholesalerVO createWholesalerVO(){
// Create Parent
WholesalerVO vo = new WholesalerVO();
//create child and set child in parent
vo.setWsRateplanVOList(getRateplanVOList(vo));
return vo;
}
//create child
private static List getRateplanVOList(WholesalerVO wsvo){
// Create child and set parent in child
ArrayList list = new ArrayList();
WSRateplanVO vo = new WSRateplanVO();
vo.setClassCode("c");
vo.setRateplanId("R");
vo.setWholesalerVO(wsvo);
list.add(vo);
return list;
}