Trying to manage some collection on an entity, I found that my setter don't set correctly the collection. I ask on some forums without finding why this behavior happen.
I made several tests and I'm here:
the setter in my example must set the collection and when the persist method is call it recreate the entity and then call the setter. But some strange things happen and during its execution the argument map is emptied (juste after the call to clear)
Some people gave me advices about the good practices for manipulate collections, but I think this case is not concerned with this.
I create a test case that reproduce the issue: https://github.com/Mohicane/jpa-accesstype/tree/master/accesstype.property.testcase
I finally find what happen (I hope): when the setter is call, the map argument is the same instance as the map entity. So when the clear is done, the map is empty. CQFD
But this is a problem. I'm not an Hibernate expert, but I see here either an efficiency problem (why set the map with the same instance. the map is allready uptodate), or a real problem (if it's important to execute the set, then it must be an independant collection no?)
Windows 10 Professional 64bits