-->
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: What to do if there is many to many relation in the database
PostPosted: Thu Dec 02, 2010 9:42 pm 
Newbie

Joined: Thu Dec 02, 2010 9:30 pm
Posts: 2
I am new to the Hibernate framework.

I have many to many relation in the database. I understand that an associatiion table will be created to store foreign keys. But, I think something has to be done if I use the Hibernate framework.

My question is what has to be done?

Thank you.


Top
 Profile  
 
 Post subject: Re: What to do if there is many to many relation in the database
PostPosted: Fri Dec 03, 2010 6:47 am 
Beginner
Beginner

Joined: Fri Nov 26, 2010 8:25 am
Posts: 21
Hello,

You need to define a Hibernate mapping of the many to many association to a table structure. If you are unsing Hibernate annotations, this documentation should help :
http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html/entity.html#entity-mapping-association

If you are using hbm.cfg.xml see this section of the tutorial in the Hibernate reference docs, if you are new to Hibernate it would probably be worth you reading the whole tutorial section.

http://docs.jboss.org/hibernate/core/3.5/reference/en/html_single/#tutorial-associations-unidirset

and

http://docs.jboss.org/hibernate/core/3.5/reference/en/html_single/#collections-ofvalues

That should provide you with what you need to get started,

Kate.


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.