Hi All,
I am stuck with a rather simple problem, which is huge for a beginner like me.
My data model has 3 tables MenuHolder, MenuItems and BehaviourProperties.
The MenuHolder and MenuItems both have BehaviourProperties.
Many MenuHolder rows can have same BehaviourProperties. Here the Main class is MenuHolder.
The properties of MenuHolder class include
private int mhId;
private String mhName;
private String mhDescription;
private String mhHolderBgcolorMouseover;
.
.
.
.
private BehaviourPropertiesModel mhBehaviourProperties;
private List menuItems;
<class name="com.analog.components.menus.model.MenuHolderModel" table="MENU_HOLDER">
<id name="mhId" column="MH_ID">
<generator class="native"/>
</id>
.......
<list name="menuItems" table="MENU_HOLDER_MENU_ITEM_MAP" lazy="true">
<key column="MHMIM_MH_ID"/>
<index column="MI_ID"/>
<many-to-many class="com.analog.components.menus.model.MenuItemModel" column="MHMIM_MI_ID"/>
</list>
<many-to-one name="mhBehaviourProperties" class="com.analog.components.menus.model.BehaviourPropertiesModel"
column="MH_BP_ID" />
</class>
How would i know if the BehaviourProperties exists? the BehaviourProperties class structure is like this...
private int bpId;
private float bpItemOffsetLeft;
private float bpItemOffsetTop;
.
.
.
So if the bpId is not 0 then the behaviour property already exists at this point update withrespect to the id.
If the id is 0 insert a new row.
Can someone help me as to where I am wrong? and direct me how to do the mapping correctly.
Thanks.
|