[hibernate-dev] lock timeout support

Strong Liu stliu at hibernate.org
Fri Jun 1 06:27:12 EDT 2012


Hi there,

I'm working on this org.hibernate.ejb.test.lock.LockTest#testFindWithPessimisticWriteLockTimeoutException test, it failed on lots of DBs

for now, I found:

sql server : supports nowait, but not other lock timeout value
DB2 : doesn't support either
sybase: doesn't support either

by "doesn't support" I mean, can't set this timeout from sql statement level, but they do support set it as a DB global config.

so, I'm wondering if we could choose this way:

1. if DB supports both, then good 
2. if DB supports nowait only, and lock timeout is set to nowait, then good
2.1 if lock timeout is set to 5 milliseconds, for example, then we setQueryTimeout(1) // (locktimeout +500)/1000+1
3. if DB doesn't supports either, then same as 2.1, use java.sql.Statement#setQueryTimeout


does this acceptable? or we just ignore lock timeout if the underlying Db doesn't support it?

-------------------------
Best Regards,

Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio



More information about the hibernate-dev mailing list