This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Confused with many to many, Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Confused with many to many, " Watch "Confused with many to many, " New topic
Author

Confused with many to many,

Diego Gusava
Greenhorn

Joined: Apr 07, 2011
Posts: 6
Hi,

i have a database with 2 tables ...






where User Manager can have one or more user above.
how i can resolve this problem, im confused ...






Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

Firstly you don't seem to have a primary key on the UserManager table, not really a problem but you may want to add in a surrogate primary key.

Secondly I'm not sure what your question is, have you made any ORM mappings? Your user model looks ok, but remember that each User will have 2 lists, 1 will be the list of managers (users) that a user has and the other will be a list of employees (users) that the user manages each of these will map to a different column in the UserManager table.

Sean


I love this place!
Diego Gusava
Greenhorn

Joined: Apr 07, 2011
Posts: 6


Sean Clark like this?
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

Yeah that looks ok to me... so what problem are you having?

Sean
Diego Gusava
Greenhorn

Joined: Apr 07, 2011
Posts: 6
Thanks Sean Clark! i was confused only. Its correct now.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Confused with many to many,