-->
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 create and Handle M:N relation with additional link.
PostPosted: Sun Mar 21, 2010 2:55 am 
Newbie

Joined: Sun Mar 21, 2010 2:44 am
Posts: 1
Dear All,

What is the best way to map the below relationship (M:N relation with additional link) in hibernate?

Developer may have more than one skill , and skill can be shared by more than one developer.
I need to hold how many years of experience the developer has in each skill.

Code:
public class Developer{
  private Set skills;
}


public class Skill{

}


public class Knowledge {
   private Developer developer;
   private Skill skill;
   private int experience; // this field holds extra information about both associated entities
}


Thanks & regards
Suhaib


Top
 Profile  
 
 Post subject: Re: How to create and Handle M:N relation with additional link.
PostPosted: Mon Mar 22, 2010 6:48 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
The book 'Java Persistence with Hibernate' treats this topic under the section 'adding columns to join tables' , chapter 7.2.3.

There are different 2 approaches to realize this:
1. Mapping the join table to an intermediate entity
2. Mapping the join table to a collection of components

Unfortunately this topic is to complex to report it here (I would have to retype the content of 7 whole pages).


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.