-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: many-to-one design help
PostPosted: Wed Jun 23, 2004 4:54 pm 
Newbie

Joined: Wed Jun 23, 2004 3:50 pm
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.