You can set a timeout at the specific request level or if you use JPA EntityManager you can add a hint .
The theory is that Hibernate uses optimistic locking by default (if the database transaction isolation level matches this), so records are never locked again, writing or reading. As a result, even a long transaction should not greatly degrade performance.
If you are using Psimic Lock, you can set a timeout for them in a Hibernate session. Take a look at Session.LockRequest .
source
share