我有以下的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
答案 0 :(得分:1)
from Department dept WITH(nolock) inner join fetch dept.employees emp where dept.Id = :DeptId
试试这个。 请注意FROM(nolock)附加到FROM子句。