-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to Insert Additional Data in a Many to Many Link Table
PostPosted: Tue Jan 10, 2006 4:59 am 
Beginner
Beginner

Joined: Mon Oct 17, 2005 1:58 am
Posts: 27
I have implemented a many to many relationship between two tables using a Link table.When i insert data into these two tables data is automatically inserted into the link table.

But the problem is that in the Link Table, in addition to the Link Fields, I need to maintain Two more fields.

Can anyone tell me how i can insert data into the additional fields while inserting data inti the two main tables.

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 11:53 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
You have to use two many-to-one relationships and use a type for the link table. So if you currently have two classes "Foo" and "Bar", you need to change it to "Foo" *-1 "FooBarLink" 1-* "Bar".


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 11:15 pm 
Beginner
Beginner

Joined: Mon Oct 17, 2005 1:58 am
Posts: 27
Thanks.But can't I achieve the same using a Many-To-Many Mapping between the two tables.Or is it not advisable to use Many To Many in such a situation?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.