Domanda

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
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top