hibernate/hibernate-orm — pull request #317 by bvarner (2012-04-20 14:10:28+00:00)
Title: HHH-7252 AbstractEntityManagerImpl.find() not throwing proper exception types for LockTimeout.

This issue is only testable when the database dialects throw the proper Hibernate Exception type for SQL Errors generated by lock timeouts.

Unfortunately, adding this test case exposes that most of the database dialects in Hibernate are not mapping SQL Errors for timeouts properly.

There are a few exceptions.
* This patch corrects the behavior for H2, and cleans up the handling for PostgreSQL.
* Oracle and Derby probably work, but I do not have the resources locally to verify these. The code for handling Oracle & Derby timeouts may need to be moved from SQLStateConversionDelegate into delegates provided by the dialects (if the codes really are vendor / dialect specific). There is also some code-smell in the SQLStateConversionDelegate regarding QueryTimeoutExceptions for MySQL and Oracle that may be appropriate to move as well.

I've been talking with sebersol on freenode the last few days about this, and was instructed to go ahead and make this pull request. If I had access to the RedHat test systems I would have already addressed these issues. I expect this request to cause some matrix tests to start failing. I will be happy to assist in fixing those (and the dialects which fail) if I can somehow get access to the logs for the failures (which should have the JDBCException dumps with the proper error states for each dialect).