Uploaded image for project: 'Hibernate ORM'
  1. HHH-12561

bulk_id_strategy does not work with globally_quoted_identifiers

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.17, 5.3.1
    • Fix Version/s: 5.2.18, 5.3.2
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • backPortable:
      Backport?
    • Last commented by a user?:
      true

      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

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: