This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes Confused... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Confused..." Watch "Confused..." New topic
Author

Confused...

Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
I have a three tables, one of projects, one of developers, and one that relates the two. How would should I represent the last table in hibernate?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
In the mapping for class Project:


In the mapping for class Developer:


see 7.5.3. many to many

Of course in reality there would be some information attached to that association (begin, end, % commitment, etc.). In that case each row in the association table would be an "Assignment" object. Each project would have many developer assignments and each developer would have many project assignments (hopefully few simultaneous ones - but we are talking the real world here).
[ March 31, 2006: Message edited by: Peer Reynders ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Confused...