-->
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: problems with many-to-many relation
PostPosted: Fri Aug 03, 2007 9:40 am 
Newbie

Joined: Thu Jul 19, 2007 4:18 am
Posts: 5
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:3.2

Hi, I have a problem with the relation many-to-many.
I want to mapping a many-to-many relation between 2 table with an extra column.

there's be a table PERSON (person_id,name,age), a table work(work_id,title) and a relation many-to-many that is map in a table person_work with column work_id,person_id and an extra column pubblication date (there's be many pubblication date of a work,for example a book, of a person).

I now that the simple many-to-many relation is mapping as follow:
<set name="work" table="Person_Work">
<key column="id" />
<many-to-many column="id_work" class="lemure.Work" />
</set>
How can I inser an extra column in the tables Person_Work???


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 03, 2007 10:14 am 
Newbie

Joined: Tue Mar 06, 2007 1:35 pm
Posts: 10
Hi there.

A nice approach is to use a relation (contract) entity. It means that your relation table now has an entity mapping it, and you can fill it with your extra information.

HTH


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.