bulk_id_strategy does not work with globally_quoted_identifiers

Description

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.jpa.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.properties.hibernate.hql.bulk_id_strategy=org.hibernate.hql.spi.id.inline.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 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

Tested with H2 and MySQL, if I remove the globally_quoted_identifiers configuration it works

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Maximiliano De Lorenzo

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure