-->
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.  [ 2 posts ] 
Author Message
 Post subject: equal method for a class in a set which has a composite-elem
PostPosted: Thu Nov 16, 2006 4:04 pm 
Newbie

Joined: Thu Nov 16, 2006 3:48 pm
Posts: 3
I have a Set of Objects with in a class. That Object belong to Mapping table which has more attributes. (Hibernate manual 8.2. Collections of dependent objects) I created a composite-element which can hold attribute for many to many mapping. I am trying to write equal method to the composite-element class. The problem i have is this class now does not know the parent class. so i cannot get the key of the parent. I need that to write the equal method. How to achieve this. Please look at part of mapping file.

<set name="wsMessageEventMap" table="WS_MESSAGE_EVENT_MAP" lazy="true">
<key column="WS_MESSAGE_ID" ></key>
<composite-element class="com.aviall.framework.logwsmsgs.dataobjects.WsMessageEventMap" >
<many-to-one name="event" column="WS_EVENTS_ID" class="com.aviall.framework.logwsmsgs.dataobjects.WsEvents" not-null="true" />
<many-to-one name="status" column="WS_STATUS_ID" class="com.aviall.framework.logwsmsgs.dataobjects.WsStatus" not-null="true" />
<property name="wsEventStartTime" column="WS_MEMAP_START_DATETIME" type="timestamp" />
<property name="wsEventEndTime" column="WS_MEMAP_END_DATETIME" type="timestamp" />
<property name="wsMapCreatedBy" column="WS_MEMAP_CREATED_BY" type="string" />
<property name="wsMapUpdatedBy" column="WS_MEMAP_UPDATED_BY" type="string" />
</composite-element>
</set>


Top
 Profile  
 
 Post subject: <parent> tag
PostPosted: Tue Feb 06, 2007 1:11 pm 
Newbie

Joined: Tue Feb 06, 2007 11:20 am
Posts: 2
Try this : (Hibernate manual 8.1 last paragraph)


<set name="wsMessageEventMap" table="WS_MESSAGE_EVENT_MAP" lazy="true">
<key column="WS_MESSAGE_ID" ></key>
<composite-element class="com.aviall.framework.logwsmsgs.dataobjects.WsMessageEventMap" >
<parent name="parentName"/> <!-- reference back to parent
<many-to-one name="event" column="WS_EVENTS_ID" class="com.aviall.framework.logwsmsgs.dataobjects.WsEvents" not-null="true" />
<many-to-one name="status" column="WS_STATUS_ID" class="com.aviall.framework.logwsmsgs.dataobjects.WsStatus" not-null="true" />
<property name="wsEventStartTime" column="WS_MEMAP_START_DATETIME" type="timestamp" />
<property name="wsEventEndTime" column="WS_MEMAP_END_DATETIME" type="timestamp" />
<property name="wsMapCreatedBy" column="WS_MEMAP_CREATED_BY" type="string" />
<property name="wsMapUpdatedBy" column="WS_MEMAP_UPDATED_BY" type="string" />
</composite-element>
</set>


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

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.