-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Are boolean literals in where clause supported?
PostPosted: Sat Aug 16, 2008 2:19 am 
Newbie

Joined: Sat Aug 16, 2008 1:54 am
Posts: 2
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.