Mario Ivankovits schrieb:
> Hi!
>> session.lock(object, LockMode.NONE)
> This might also fail if the object already exists in the current
> session, no?
> 
> You can safely reattach the object using
> 
> object = session.merge(object)
> 
> Though, you really should discard the old object then and work further
> with the new one.
> 
Just to add additional comments.
Session merge is a convenience method introduced in Hiberante 3.1 (and
EJB3) due to the fact that the having an object coming in over session
boundaries and doing a simple save or update simply caused to many
problems (constantly clashes with objects already loaded by predecessing
queries)

Thus session.merge und session.persist were introduced.


Reply via email to