This content has been marked as final.
Show 1 reply
-
1. Re: many to many mapping exception in EJB3
wolfgangknauf Oct 24, 2008 11:09 AM (in response to mravikrish)Hi,
bi-directional mappings are a bit tricky: you always have to update BOTH sides of the mapping.
So, if you want to map a Skill to an User, this will NOT work:user.getSkills().add ( mySkill); entityManager.merge(user);
You will have to do something like this:myUser.getSkills().add ( mySkill); mySkill.getUsers().add (myUser); entityManager.merge(myUser);
Hope this helps
Wolfgang