Question

My application uses Java, Hibernate, and IBM DB2 database. I would like to use pessimistic locking when updating and writing data so other threads need to wait for the resource to be available before trying to update it. However, I want threads to always be able to read data (regardless of whether it is locked or not i.e. transactions are open for the data), and read operations never lock data. What isolation level would fulfil this in Hibernate and IBM DB2? Thanks.

Pas de solution correcte

Autres conseils

Not sure about Hibernate, but on the DB2 side you can use either uncommitted read isolation level or cursor stability isolation along with the activated "currently committed" semantics (the latter is available in DB2 LUW 9.7 and later).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top