This content has been marked as final.
Show 2 replies
-
1. Re: Which methods should an Entity contain?
wolfgangknauf Dec 12, 2008 6:16 AM (in response to nschweig)Hi Nicki,
My 2 cent: I would suggest to place "addRole" and "removeRole" in the session bean. The reason is that for relationships, both sides of the relation must be modified:
For example this snippet will add a new user-to-role-connection:myUser.getRoles().add (myRole); myRole.getUsers().add (myUser);
Placing this in an entity breaks data encapsulation principles, because the entity manipulates other entitities ;-). But technically, it would work in the entity, too. It is just "dirty".
Best regards
Wolfgang -
2. Re: Which methods should an Entity contain?
nschweig Dec 12, 2008 7:44 AM (in response to nschweig)Hi,
thank you for your response.
I thought that, too but were not sure.
Thanks, Nicki