I have a query that is fetching some data from a PostgreSQL database using LockMode.UPGRADE_NOWAIT. However, when Hibernate is unable to obtain a lock, because another process already has a pessimistic lock on the same row, instead of throwing a LockAcquisitionException, it actually waits for the lock. I looked at the PostgreSQLDialect and it does not correctly implement getForUpdateNoWaitString -- it delegates to getForUpdateString. I am using Hibernate 3.3.2 and PostgreSQL 9.1. It looks like Postgres supports NOWAIT [1], so why is the dialect not implementing it? I couldn't find any bugs on this, but can log one, if needed.
[1]
http://www.postgresql.org/docs/9.1/stat ... elect.htmlEdit: I just checked master on the Hibernate git repo, and it looks like this hasn't changed [2] (the implementation of the getForUpdateNoWaitString method lives in the Dialect class that delegates to getForUpdateString).
[2]
https://github.com/hibernate/hibernate- ... alect.java