-->
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: M:N relation extra field in this table
PostPosted: Wed Sep 15, 2004 9:49 am 
Newbie

Joined: Wed Sep 15, 2004 9:35 am
Posts: 13
hi,
I have a m:n relation table.
in this table are a component id and a material id. Extra there is a weightiness it is incidental from the component id and the material id.
how can I map the weight to hibernate? i


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 15, 2004 11:22 am 
Regular
Regular

Joined: Tue Jan 27, 2004 12:22 pm
Posts: 103
Hello zAEL,

You should make a new composite object which renders the relation. The new object contains a new attribute weight.
In hibernate this can be mapped like this:
Code:
<class ...>
<set name="materials" table="component_material">
<key column="componentid"/>
<composite-element class="MyNewCompositeElement">
<many-to-one name="material" class="Material" column="materialid" />
<property name="weight"/>
</composite-element>
</set>
</class>


Hope this helps.

_________________
Dencel
- The sun has never seen a shadow -


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.