-->
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: Query : strange behaviour
PostPosted: Fri Feb 17, 2006 5:45 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hi everybody!

Can someone explain me why the first query doesn't work while the second works? :

Query that doesn't work :

String hqlQuery = " from Dnasalary "+
" where campagne = :campagne "+
" and numeroadherent = :numeroadherent "+
" and TRIM(UPPER(nomsalariedna)) like TRIM(UPPER(:nomsalariedna)) "+
" order by nomsalariedna ";

dnasalarysList = session.createQuery(hqlQuery).setInteger("campagne",campagne).setInteger("numeroadherent",numeroadherent).setString("nomsalariedna",nomsalariedna).list();

I got the error : DB2 SQL0418 Use of parameter marker is not valid. SQL0419, SQLCODE -419 SQLSTATE 42911


Query that works :

String hqlQuery = " from Dnasalary "+
" where campagne = :campagne "+
" and numeroadherent = :numeroadherent "+
" and TRIM(UPPER(nomsalariedna)) like TRIM(UPPER('"+nomsalariedna+"%')) "+
" order by nomsalariedna ";

dnasalarysList = session.createQuery(hqlQuery).setInteger("campagne",campagne).setInteger("numeroadherent",numeroadherent).list();


As you can see, the only difference is that didn't use a nammed parameter...if someone can explain me....I won't die stupid...;o)

Thanks


Top
 Profile  
 
 Post subject: sql
PostPosted: Fri Feb 17, 2006 3:01 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Please look at the server logs and see/post the exact SQL that was generated. It sure should provide a clue.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.