Regular |
|
Joined: Sun Sep 17, 2006 2:48 am Posts: 81 Location: California
|
I am trying to create 2 entities(User and Role) which has many-to-many bidirectional relationship among them. So 1 User can have multiple roles and 1 role can be associated with multiple users. When I use <many-to-many> elements in the mapping files I am forced to use
Set<Role> roleSet;
in my User entity and
Set<User> userSet;
in my Role entity.
Is there any way I can simply specify a set of foreign key ( Set<Long> roleId; in User.java and Set<Long> userId; in Role.java) instead of a complete set of entities? If possible, how would the mapping XML look like?
Thanks
|
|