Please try the following annotation in your User object.
Please try the following annotation in your User object: @ManyToMany(cascade = {CascadeType. ALL}).
I'll give that a try in the morning -- although we did add @ManyToMany(cascade = {CascadeType. PERSIST, CascadeType. MERGE}) already.
– Jim Kiley Jun 4 '09 at 0:38.
The problem is that you have a bi-directional relation, and in this case there is one entity that controls the other, and from your mapping the controlling one is the Store entity and not the User, so adding a user to a store would work (since the Store is the one who controls) but adding a store to a user will not. Try inverting the situation, by making the User object the one who controls the relation, by putting the @ManyToMany(mappedBy = "users") annotation on the getStores() method and changing the getUsers() one. Hope it helped.P.S.The entity that controls the relation is always the one that doesn't have the mappedBy attribute.
I just got stuck to same problem and found solution on another page. Here is what has worked for me calling getJpaTemplate().flush() before calling merge has worked for me. I did not get the reason why it worked.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.