-->
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: "Unknown column 'false' in 'where clause'"
PostPosted: Sun Apr 18, 2004 8:43 am 
Newbie

Joined: Sat Jan 10, 2004 5:45 pm
Posts: 12
Location: Hong Kong
hi sir,

i get a quite "Strange" exception, i would like to know how to due with it?

i am running my application on MySQL 4.0.12
but it interpret my 'false' boolean value as a column name

the sql statement look like this one

String sql = "SELECT chu FROM hk.hku.csis.wsr.database.table.ConfigHasUUId as chu, " +
"hk.hku.csis.wsr.database.table.UUIdMessageId as UUIdMessageId WHERE " +
"chu.conversationId = '" + conversationId + "' AND " +
"UUIdMessageId.uuId = chu.uuId AND " +
"UUIdMessageId.delivered = " + false + " AND " +
"UUIdMessageId.outgoing = " + false;

I also tried the following one


String sql = "SELECT chu FROM hk.hku.csis.wsr.database.table.ConfigHasUUId as chu, " +
"hk.hku.csis.wsr.database.table.UUIdMessageId as UUIdMessageId WHERE " +
"chu.conversationId = '" + conversationId + "' AND " +
"UUIdMessageId.uuId = chu.uuId AND " +
"UUIdMessageId.delivered = false AND " +
"UUIdMessageId.outgoing = false";




the 2 statements above run perfect in postgresql 7.3.4

THX


wsr




- SQL Error: 1054, SQLState: S0022
- Column not found, message from server: "Unknown column 'false' in 'where clause'"
- Could not execute query
java.sql.SQLException: Column not found, message from server: "Unknown column 'false' in 'where clause'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1905)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2090)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1496)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:71)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:551)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:140)
at net.sf.hibernate.loader.Loader.find(Loader.java:620)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:928)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1343)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1322)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1314)
at hk.hku.csis.wsr.database.MessageIdMappingHibernateImpl.getTEntry(MessageIdMappingHibernateImpl.java:403)
at hk.hku.csis.wsr.database.MessageIdMappingHibernateImpl.getUUIdMessageId(MessageIdMappingHibernateImpl.java:195)
at hk.hku.csis.wsr.database.MessageIdMappingHibernateImpl.getWSRMMessageId(MessageIdMappingHibernateImpl.java:60)
at hk.hku.csis.wsr.database.WSRMMessageStoreHibernateImpl.getWSRMMessageId(WSRMMessageStoreHibernateImpl.java:1196)
at hk.hku.csis.wsr.client.handler.WSRMServiceFacadeImpl1_1.receive(WSRMServiceFacadeImpl1_1.java:134)
at hk.hku.csis.wsr.client.handler.WSRMService.receive(WSRMService.java:82)
at hk.hku.csis.wsr.client.handler.WSRMService.main(WSRMService.java:232)
hk.hku.csis.wsr.data.WSRMException: hk.hku.csis.wsr.database.WSRMPersistenceException: Could not execute query: Column not found, message from server: "Unknown column 'false' in 'where clause'"
at hk.hku.csis.wsr.client.handler.WSRMServiceFacadeImpl1_1.receive(WSRMServiceFacadeImpl1_1.java:138)
at hk.hku.csis.wsr.client.handler.WSRMService.receive(WSRMService.java:82)
at hk.hku.csis.wsr.client.handler.WSRMService.main(WSRMService.java:232)
Caused by: hk.hku.csis.wsr.database.WSRMPersistenceException: Could not execute query: Column not found, message from server: "Unknown column 'false' in 'where clause'"
at hk.hku.csis.wsr.database.MessageIdMappingHibernateImpl.getTEntry(MessageIdMappingHibernateImpl.java:410)
at hk.hku.csis.wsr.database.MessageIdMappingHibernateImpl.getUUIdMessageId(MessageIdMappingHibernateImpl.java:195)
at hk.hku.csis.wsr.database.MessageIdMappingHibernateImpl.getWSRMMessageId(MessageIdMappingHibernateImpl.java:60)
at hk.hku.csis.wsr.database.WSRMMessageStoreH


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 18, 2004 9:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Do not use string concatenation to build your query, use parameter placeholders and setParameter()


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.