The Exception thrown to the application regarding Hibernate included in JBoss EAP 7 differs between SQLServer2005Dialect and SQLServerDialect.

Solution Unverified - Updated -

Issue

  • When the following SQLServerException occurs in MS SQLServer's JDBC Driver, Hibernate's SQLServer2005Dialect throws org.hibernate.exception.LockTimeoutException to an application, but Hibernate's SQLServerDialect throws org.hibernate.exception.SQLGrammarException.

    Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Lock request time out period exceeded.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
    at com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer.nextRow(SQLServerResultSet.java:5415)
    at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1758)
    at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:1016)
    at org.jboss.jca.adapters.jdbc.WrappedResultSet.next(WrappedResultSet.java:2689)
     ...snip...
    

    (The above Lock request time out period exceeded error occurs when MS SQL Server returns Event ID 1222. See the details is here(MSSQLSERVER_1222).)

  • So an application gets a different Exception from Hibernate between using SQLServer2005Dialect and using SQLServerDialect.
    • SQLServer2005Dialect => org.hibernate.exception.LockTimeoutException
    • SQLServerDialect => org.hibernate.exception.SQLGrammarException

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content