-->
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: How to do Many to Many mapping?
PostPosted: Sat Jul 10, 2010 5:22 pm 
Newbie

Joined: Sat Jul 10, 2010 4:22 pm
Posts: 3
Hi guys,

I've looked over the manual and the forum, and I'm still confused on how to get this to work.

Let's say I have two tables and want this setup:

Table 1 --> Table 3 < -- Table 2

In this case, Table 1 and Table 2 have a many to many relationship with Table 3 being the mediator.

I need Table 3 set up where it has these fields:
Table1_id
Table2_id
column1;
column2;

So basically, table 3 not only links table 1 and table 2 but it also has extra columns. I know Hibernate creates Table 3, the linking table, for me automatically. Is it possible to create a Java POJO for table 3 so it can hold those extra columns? And if yes, would I just create properties in there called Table1_id and Table2_id? I actually tried this but I couldn't get it to work, so I am hoping one of the gurus on this forum can help me.

How would I go about doing this?

For my project, I am not worried at all about retrieving the data, since the database is being used by a different program. I just need to populate the database.


Top
 Profile  
 
 Post subject: Re: How to do Many to Many mapping?
PostPosted: Sun Jul 11, 2010 9:03 am 
Newbie

Joined: Tue Jun 29, 2010 2:14 am
Posts: 8
Take a look
https://forum.hibernate.org/viewtopic.php?f=1&t=1005707


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.