Hibernate version: 3.3.0 GA
Full stack trace of any exception that occurs:
org.hibernate.QueryException: Unable to render boolean literal value [SELECT COUNT(item) FROM org.example.runtime.impl.repository.db.jpa.DbItem item WHERE ( NOT (item.deleted = TRUE) ) AND ( item.application IS NULL ) AND ( item.owner = :owner ) AND ( ( (:searchService = TRUE) AND (item.itemType = 'SERVICE') ) OR ( (:searchApplication = TRUE) AND (item.itemType = 'APPLICATION') ) OR ( (:searchWidget = TRUE) AND (item.itemType = 'WIDGET') ) OR ( (:searchSnippet = TRUE) AND (item.itemType = 'SNIPPET') ) )]
at org.hibernate.hql.ast.tree.BooleanLiteralNode.getRenderText(BooleanLiteralNode.java:71)
at org.hibernate.hql.ast.SqlGenerator.out(SqlGenerator.java:73)
at org.hibernate.hql.antlr.SqlGeneratorBase.simpleExpr(SqlGeneratorBase.java:2376)
at org.hibernate.hql.antlr.SqlGeneratorBase.expr(SqlGeneratorBase.java:1356)
at org.hibernate.hql.antlr.SqlGeneratorBase.binaryComparisonExpression(SqlGeneratorBase.java:2659)
at org.hibernate.hql.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1190)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:853)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanOp(SqlGeneratorBase.java:2555)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:833)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanOp(SqlGeneratorBase.java:2555)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:833)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanOp(SqlGeneratorBase.java:2555)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:833)
at org.hibernate.hql.antlr.SqlGeneratorBase.whereExpr(SqlGeneratorBase.java:725)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:184)
at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:117)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:236)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:436)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:384)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
...
Caused by: java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.BooleanType
at org.hibernate.hql.ast.tree.BooleanLiteralNode.getTypeInternal(BooleanLiteralNode.java:46)
at org.hibernate.hql.ast.tree.BooleanLiteralNode.getRenderText(BooleanLiteralNode.java:68)
... 40 more
Name and version of the database you are using:
Mysql 5.0
I am using hibernate-entitymanager 3.3.2GA
Found a couple old posts asking the same thing, but without a response.
http://forum.hibernate.org/viewtopic.php?p=2338021&sid=2fdd17e1d38f88350fcd9f0430139fc1
The resolution comments of
issue EJB-323 seem to indicate that this should work.
BTW I have tried with and without the following property:
<property name="hibernate.query.substitutions" value="true 1, false 0"/>
Is there another option to use?
Thanks!