Bug is caused by using string query and optimistic/optimistic_force_increment lock for HANA DB. It generates wrong sql query for HANA data base. Generated sql query for hana: select someentity0_.id as id1_0_, someentity0_.version as version2_0_ from SomeEntity someentity0_ where someentity0_.id=1 of someentity0_.id| The most valuable exception is bellow: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "of": line 1 col 124 (at pos 124) The research showed problem is in the method of "AbstractHANADialect" class with signature "String getForUpdateString(final String aliases, final LockOptions lockOptions)" in line 493. Probablly line that is bellow causes the problem: String clause = getForUpdateString( lockMode ) + " of " + aliases; When optimistic lock is used, "getForUpdateString( lockMode )" returns empty line. And then it concatinates with aliases. It's incorrect. As suggestion to make hot fix, line that is bellow String clause = getForUpdateString( lockMode ) + " of " + aliases; should be replaced by String clause = ""; if(lockMode != LockMode.OPTIMISTIC && lockMode != OPTIMISTIC_FORCE_INCREMENT) { clause = getForUpdateString( lockMode ) + " of " + aliases; } see: https://github.com/Bamiiup/hibernateIssues/tree/master/HibernateHanaOptimisticLockForceIncrement |
|