-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL query with boolean field
PostPosted: Mon Jul 04, 2005 7:33 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.8

Mapping documents:
<class name="es.cyii.formuWeb.model.Contact" table="CONTACTS">

<id name="IdContact" type="integer">
<column name="IDCONTACT"/>
<generator class="sequence">
<param name="sequence">SEQ_CONTACTS</param>
</generator>
</id>
...
<property name="Answered" type="true_false">
<column name="ANSWERED"/>
</property>
...

Code between sessionFactory.openSession() and session.close():

sSQL = "from Contact as ta where not ta.Answered";
results = getHibernateTemplate().find(sSQL);

Exception

javax.servlet.ServletException: Incorrect query syntax [from es.cyii.formuWeb.model.Contact as ta where not ta.Answered]; nested exception is net.sf.hibernate.QueryException: Incorrect query syntax [from es.cyii.formuWeb.model.Contact as ta where not ta.Answered]

Name and version of the database you are using:
Oracle 8.1.6

The generated SQL (show_sql=true):


This is the error I have, I think the syntax is correct, I have try too with

ta.Anwered == true and obtain an error too.


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 04, 2005 4:44 pm 
Regular
Regular

Joined: Thu Jul 08, 2004 1:21 pm
Posts: 68
Location: Recife - Pernambuco - Brazil
You need to set a property (hibernate.properties or hibernate.cfg.xml) called hibernate.query.substitutions to something like the code below
Code:
hibernate.query.substitutions= true 1, false 0, yes 'Y', no 'N'

If it was setted yet, please, search for some typo (is the property name really "Answered" instead "answered"?).

valeuz...

_________________
Marcos Silva Pereira
http://blastemica.blogspot.com


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

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.