I searched for ways to query with nolock
from JPA, but I get errors saying I'm not in a transaction, which is true
. Is it possible to turn off locking without a transaction?
Asked
Active
Viewed 1,475 times
2

Dale K
- 25,246
- 15
- 42
- 71

Joshua Glickman
- 35
- 5
-
Maybe you can find an answer here: https://stackoverflow.com/questions/26327274/do-you-need-a-database-transaction-for-reading-data/26327536 – Adrian Farmadin Feb 02 '18 at 21:24
-
I don't think the nolock hint does what you think it does. It does not prevent all locking. And honestly you probably really don't want to query with nolock. Unless you are ok with mostly accurate results most of the time you should avoid this. Here is a great article on the topic. https://blogs.sentryone.com/aaronbertrand/bad-habits-nolock-everywhere/ – Sean Lange Feb 02 '18 at 22:25