简体   繁体   中英

Purpose of Hibernate Session locking using interceptor in method calling session.save/update

Please help me in understanding the usage of session lock.

Hibernate session is re-associated to the detached object using AOP interceptor which will perform the below logic

session.buildLockRequest(LockOptions.NONE).lock(object);

Is there is any advantage of using this interceptor in method which call the session.save/update?

Will the optimistic locking ignored when the session lock is used?

depends on what object is. This will basicly tell the session that object is a unmodified persistent entity which should now be associated to the session the same way as objects loaded through the session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM