-
Bug
-
Resolution: Won't Do
-
Major
-
EJB 3.0 RC1
-
None
-
None
I have the following scenario. A User has several Roles. The relationship between user and role is defined as a bi-directional many-to-many relationship.
- User A has Role A.
- To retrieve Roles use :
User userA = ....
Roles roles = userA.getRoles()
- Then I contruct a new user and assign roles to it
User userB = new User();
userB.setRoles(userA.getRoles());
- Then I pass my use to the UserManagerBean to persist it
UserManager.createNewUser(userB);
-At this point what I percieve is happening is that all the roles which were previously associated with userA are now reassigned to userB. I have tried retrieving the "new" roles which resulted in :
User userB = new User();
userB.setRoles(UserManager.getRoles());
- In this case the behaviour was correct
The relationship between user and roles is a ManyToMany relationship without cascading and I am useing JBoss 4.0.3 RC 1 on JDK 1.5.0_04 on Windows XP.
Any suggestions on this. I believe this to be a bug.