File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Confused..." Watch "Confused..." New topic


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

Joined: Aug 19, 2005
Posts: 2933
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 ]
I agree. Here's the link:
subject: Confused...
jQuery in Action, 3rd edition