Asking help for many-to-many properties persistence in Hibernate?

The Genres list which bernates creates for you is not a simple java.util. LinkedList, it is connected to the Session and supports lazy-fetching, minimal puts and whatnot. In this case, it carries knowledge of its parent object and when you move it, it makes the undesired updates to the association table.

The Genres list which bernates creates for you is not a simple java.util. LinkedList, it is connected to the Session and supports lazy-fetching, minimal puts and whatnot. In this case, it carries knowledge of its parent object and when you move it, it makes the undesired updates to the association table.

Instead, you should make the actual collection final, avoid setGenre() and instead of it, you should introduce "smarter" mutators, like addToGenre(Genre... genre), replaceGenres(List newGenres). Hope this helps!

JesperSM, you are definitely right. The collecting list of Genres is an instance of org.hibernate.collection. PersistentBag, which carries the relationship, etc.Thanks a lot!

– tom_tom Sep 10 '10 at 0:36.

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.

Related Questions