Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.4
    • Fix Version/s: 5.0.3, 5.1.0
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      Same as this https://hibernate.atlassian.net/browse/HHH-8866 but with boolean attribute and string-to-boolean converter.

      Example of exception:

      org.hibernate.QueryException: Unable to render boolean literal value [SELECT e FROM SampleEntity e WHERE e.booleanValue = true]
      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1750)
      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)
      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683)
      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:350)
      at pl.avd.sample.jpa.converters.CarService.findDieselsWithNamedQuery(CarService.java:94)
      at pl.avd.sample.jpa.multiselect.CarServiceTest.findDieselsWithNamedQueryTest(CarServiceTest.java:48)
      Caused by: org.hibernate.QueryException: Unable to render boolean literal value [SELECT e FROM SampleEntity e WHERE e.booleanValue = true]
      at org.hibernate.QueryException.generateQueryException(QueryException.java:137)
      at org.hibernate.QueryException.wrapWithQueryString(QueryException.java:120)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:234)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
      at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:126)
      at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:88)
      at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:190)
      at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
      at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
      at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800)
      at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:342)
      ... 36 more
      Caused by: org.hibernate.QueryException: Unable to render boolean literal value
      at org.hibernate.hql.internal.ast.tree.BooleanLiteralNode.getRenderText(BooleanLiteralNode.java:65)
      at org.hibernate.hql.internal.ast.SqlGenerator.out(SqlGenerator.java:128)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.simpleExpr(SqlGeneratorBase.java:2942)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.expr(SqlGeneratorBase.java:1585)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.binaryComparisonExpression(SqlGeneratorBase.java:3236)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1395)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:921)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.whereExpr(SqlGeneratorBase.java:768)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:202)
      at org.hibernate.hql.internal.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:135)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:260)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:226)
      ... 44 more
      Caused by: java.lang.ClassCastException: org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter cannot be cast to org.hibernate.type.LiteralType
      at org.hibernate.hql.internal.ast.tree.BooleanLiteralNode.typeAsLiteralType(BooleanLiteralNode.java:70)
      at org.hibernate.hql.internal.ast.tree.BooleanLiteralNode.getRenderText(BooleanLiteralNode.java:62)
      ... 55 more

        Attachments

        1. AttributeConverterTestNew.java
          2 kB
        2. BooleanValueConverter.java
          1 kB
        3. EntityWithBooleanField.java
          2 kB
        4. testcase-jpa-converters.zip
          6 kB
        5. testcase-jpa-converters.zip
          6 kB
        6. testcase-jpa-converters-2.zip
          14 kB
        7. YesNoBooleanConverter.java
          0.7 kB

          Issue links

            Activity

              People

              • Votes:
                9 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 1h 5m
                  1h 5m