-->
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: Named parameters in WHERE clause...
PostPosted: Tue Jun 01, 2004 3:20 pm 
Newbie

Joined: Tue Jun 01, 2004 3:03 pm
Posts: 1
I am trying to use named parameter in the where caluse using following
syntax:

int americaElementId = 106;
List invData = session.find("from ENT_ElementINV where element_id = :americaElementId ");

Compilation is ok, when executed I get following error:

Hibernate: select ent_elemen0_.id as id, ent_elemen0_.ELEMENT_ID as ELEMENT_ID,
ent_elemen0_.INV_DATE as INV_DATE, ent_elemen0_.INV_COUNT as INV_COUNT, ent_elem
en0_.LAST_CHANGED_USER as LAST_CHA5_, ent_elemen0_.LAST_CHANGED_DATE as LAST_CHA
6_ from Enterprise_Element_INV_History ent_elemen0_ where (element_id=? )
Jun 1, 2004 2:26:58 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions

WARNING: SQL Error: 1008, SQLState: 72000
Jun 1, 2004 2:26:58 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions

SEVERE: ORA-01008: not all variables bound

Jun 1, 2004 2:26:58 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions

WARNING: SQL Error: 1008, SQLState: 72000
Jun 1, 2004 2:26:58 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions

SEVERE: ORA-01008: not all variables bound

Jun 1, 2004 2:26:58 PM net.sf.hibernate.JDBCException <init>
SEVERE: Could not execute query
java.sql.SQLException: ORA-01008: not all variables bound

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:
643)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
a:1819)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:2015)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:395)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
dStatement.java:339)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
at net.sf.hibernate.loader.Loader.list(Loader.java:941)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1512)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1491)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1483)
at EnterpriseDEV.DataParser.EnterpriseParser.storeInventory(EnterprisePa
rser.java:390)
at EnterpriseDEV.DataParser.EnterpriseParser.ProcessINVLine(EnterprisePa
rser.java:168)
at EnterpriseDEV.DataParser.EnterpriseParser.main(EnterpriseParser.java:
125)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 01, 2004 3:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
use createQuery()


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.