Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-21975

[GSS](7.4.z) HHH-14616 Optimistic Lock throws "could not retrieve version" exception

XMLWordPrintable

      When a query is executed setting lock mode to LockModeType.OPTIMISTIC and hibernate.globally_quoted_identifiers is true flush/commit fails with an exception.

      ... org.hibernate.exception.GenericJDBCException: could not retrieve version: [<ENTITY_PACKAGE.ENTITY_CLASS>#<IDENTIFIER>]
      	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
      	at org.hibernate.persister.entity.AbstractEntityPersister.getCurrentVersion(AbstractEntityPersister.java:1899)
      	at org.hibernate.action.internal.EntityVerifyVersionProcess.doBeforeTransactionCompletion(EntityVerifyVersionProcess.java:43)
      	at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:954)
      	at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:525)
      	at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2507)
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:447)
      	...
      Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The column name [<NAME_OF_VERSION_PROPERTY_HERE>] is not valid.
      	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234)
      	at com.microsoft.sqlserver.jdbc.SQLServerResultSet.findColumn(SQLServerResultSet.java:699)
      	at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getLong(SQLServerResultSet.java:2353)
      	at org.hibernate.type.descriptor.sql.BigIntTypeDescriptor.doExtract(BigIntTypeDescriptor.java:63)
      	at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47)
      	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257)
      	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
      	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)
      	at org.hibernate.persister.entity.AbstractEntityPersister.getCurrentVersion(AbstractEntityPersister.java:1887)
      	...
      

      A similar symptom may be observed with multiple database types (e.g. SQL Server, Oracle, H2 ...)

              gbadner@redhat.com Gail Badner (Inactive)
              gbadner@redhat.com Gail Badner (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: