I have below hql query. i want to select without getting lock on tables Department, employees so that other query concurrent retrieve the records from these table even when below query is running/executing

from Department dept inner join fetch dept.employees  emp where dept.Id = :DeptId

i tried below but thats still acquiring locks

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

Try this. Note the WITH(nolock) appended to the FROM clause.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top