[jboss-user] [Beginner's Corner] - Re: ManyToMany problem
Wolfgang Knauf
do-not-reply at jboss.com
Fri Oct 30 07:55:02 EDT 2009
Hi,
basically, you don't need a generated ID for the mapping table because the pair "role_id/function_id" is already a valid primary key.
If you need a id column anyway, you have to build a mapping entity with a generated ID property and two @OneToMany relationship fields to Role and Function.
So your code for mapping a function to a role could be:
| RoleToFunction role2FunctionNew = new RoleToFunction();
| role2FunctionNew.setFunction(...);
| role2FunctionNew.setRole(...);
|
| role.getFunctionmappings().add (role2FunctionNew);
|
Hope this helps
Wolfgang
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4263154#4263154
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4263154
More information about the jboss-user
mailing list