I would like to know your opinion and maybe your solutions for the following problem: when an object comes back from the gui layer (e.g. in a form controllers submit), we have to reassociate this object with the hibernate session via update() or lock(...) methods. This might also be necessary for e.g. a parent of this object if it is not defined with cascade="update".
In case of the form controller the object should be updated, so calling a method like store() on the manager layer is natural. But if your application requires a different reassociation like those implemented by lock(LockMode) in Hibernate, how do you handle this?
Only the controller knows exactly which objects have to be reassociated (and which lock modes to use).
If i add methods for reassociation in the manager layer and call those from the controller, isn't this a bit ugly because it's a very persistence specific action? But the manager itself does not know which objects came from the web layer, so it cannot reassociate them...
I think nearly everybody meets this problem with hibernate pojos and spring's form controller. But i did not find any information on that.
How do you solve this problem?
Thanks for your replies!