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

HQL query against field marked with @Lob fails on PostgreSQL

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.7
    • Fix Version/s: 5.2.9
    • Component/s: hibernate-core
    • Labels:
      None
    • Environment:
      PostgreSQL 9.5
      Hibernate

      Description

      When using a simple entity as follows:

      @Entity
      public class SimpleEntity {
        @Id
        private Integer id;
        @Lob
        private String value;
      }
      

      And then issuing the following HQL query:

      List values = session.createQuery( "SELECT e FROM SimpleEntity e WHERE e.value = :value" )
         .setParameter( "value", "One" )
         .getResultList();
      

      This fails with an error:

      Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: text = bigint
        Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
        Position: 373
      

      The hibernate stack trace:

      Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
      	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106)
      	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
      	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)
      	at org.hibernate.loader.Loader.getResultSet(Loader.java:2123)
      	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1911)
      	at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)
      	at org.hibernate.loader.Loader.doQuery(Loader.java:932)
      	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)
      	at org.hibernate.loader.Loader.doList(Loader.java:2615)
      	at org.hibernate.loader.Loader.doList(Loader.java:2598)
      	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430)
      	at org.hibernate.loader.Loader.list(Loader.java:2425)
      	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
      	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:370)
      	at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
      	at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1481)
      	at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1441)
      	at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1410)
      

      I tried using the latest 9.4.1212 driver version and the same error occurs.

        Attachments

          Issue links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: