我下面有hql查询。我想选择不锁定表部门的员工,以便其他查询并发检索记录
从这些表中,即使下面的查询正在运行/执行
from Department dept inner join fetch dept.employees emp where dept.Id = :DeptId
我在下面尝试过,但是多数民众赞成在仍然获得锁
from Department dept nolock inner join fetch dept.employees emp nolock where dept.Id = :DeptId
最佳答案
from Department dept WITH(nolock) inner join fetch dept.employees emp where dept.Id = :DeptId
尝试这个。
注意,WITH(nolock)附加在FROM子句中。
关于java - 是否执行Select HQL而没有锁?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22605546/