[jboss-user] [JBoss Tools] New message: "Re: seam generate entities for many-to-many relationships"

Wouter Hartog do-not-reply at jboss.com
Thu Jan 7 10:41:27 EST 2010


User development,

A new message was posted in the thread "seam generate entities for many-to-many relationships":

http://community.jboss.org/message/518777#518777

Author  : Wouter Hartog
Profile : http://community.jboss.org/people/wouterhartog

Message:
--------------------------------------------------------------
Found the solution:
I had to define my UserRole table different.
I had one UserRoleID column as the primary key, and the userId and roleId as just FK to the other tables, like this:
userRoleId (PK)
roleId (FK)
userId (FK)
 
When I changed the table structure to this (removed the original PK column):
roleID (PK, FK)
userId (PK, FK)
 
seam generate entities worked as I wanted to: on the Entity class User, I had a @ManyToMany annotation, linking to the Role table, using the UserRole table as the joinTable.
 
a great tool!

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/518777#518777




More information about the jboss-user mailing list