a) If you haven't implemented hashCode and equals in Attribute / AttributeCategory then do that right now . I've been re-reading some of the hibernate docs this week, and I remember mention of the fact that you have to do that if you want to use detached sessions (i.e. if you want to pass the object through many app layers ).
You have to override the equals() and hashCode() methods if you
* intend to put instances of persistent classes in a Set (the recommended way to represent many-valued associations) and
* intend to use reattachment of detached instances
Hibernate guarantees equivalence of persistent identity (database row) and Java identity only inside a particular session scope. So as soon as we mix instances retrieved in different sessions, we must implement equals() and hashCode() if we wish to have meaningful semantics for Sets.
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton