Configuring *bulk_id_strategy* on a project that has the *globally_quoted_identifiers* configuration on *true* fails because resolves wrong the PrimaryKey.
I have a project running with Spring Boot on the application.properties file set:
_spring spring .jpa.properties.hibernate.globally_quoted_identifiers=true spring.jpa.properties.hibernate.hql.bulk_id_strategy=org.hibernate.hql.spi.id.inline. InlineIdsOrClauseBulkIdStrategy_ InlineIdsOrClauseBulkIdStrategy
On the repository created a method with an UPDATE query:
_ @Query("UPDATE User u SET c.lastSessionStarted = :date WHERE (u.lastSessionStarted IS NULL OR u.lastSessionStarted < :date) AND u.id = :userId") _ When this method tries to run the update throws an Exception:
_Caused Caused by: org.hibernate.exception.SQLGrammarException: could not select ids for bulk operation ... Caused by: java.sql.SQLException: Column '`id`' not found. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1077) at com.mysql.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:4695) at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java) at org.hibernate.hql.spi.id.AbstractIdsBulkIdHandler.selectIds(AbstractIdsBulkIdHandler.java:93) ... 102 common frames omitted_ omitted
Tested with H2 and MySQL, if I remove the *globally_quoted_identifiers* configuration it works |
|