Should we use LockOptions instead of LockMode in the sleep request?

I see two classes to lock in sleep mode -

  • LockOptions
  • LockMode

What is the difference between the two? When to use each?

+3
source share
2 answers

Referring to the javadoc http://docs.jboss.org/hibernate/orm/4.2/javadocs/ session , the LockMode parameter should be replaced with LockOptions.

Here is an excerpt from javadoc.

@Deprecated (String entityName,                     ,                    LockMode lockMode) . LockMode LockOptions , , , .

:

entityName -

id -

lockMode -

:

+1

, MySQL for update sql :

query.setLockOptions(LockOptions.UPGRADE);
0

Source: https://habr.com/ru/post/1750303/


All Articles