Is there a way to run these queries as if I added a (NOLOCK) hint to them?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
If you really need this, then you want to do something like:
which is identical to a nolock.
Before you do that, really think carefully if you want to do a dirty read. Most of the time people do this because it's what they've always done, rather than because it's the right thing to do. In particular, this does not work well with caching.
Actually, this thread goes into the issues a little. Read carefully before deciding.
You can do the "with (nolock)" if you go native. This is extreme but if the alternative is changing the transaction isolation level, you might rather do this.
Note that this example is for MSSQL.
In latest version of Hibernate you have to do it this way: