File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confused with many to many,