The documentation for lock(Object object, LockMode lockMode) explains:
Quote:
Obtain the specified lock level upon the given object. This may be used to perform a version check (LockMode.READ), to upgrade to a pessimistic lock (LockMode.UPGRADE), or to simply reassociate a transient instance with a session (LockMode.NONE). This operation cascades to associated instances if the association is mapped with cascade="lock".
However, should not
transient be replaced with
detached? I use lock() for reassociating detached (previously persistent, not associated with any Session) objects with a given Session.
If one wish to associate a transient instance with a Session, shouldn't that transient instance first be made persistent using save(), persist() or saveOrUpdate()?