-->
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: Named parameters in SQL is not working
PostPosted: Wed Nov 11, 2009 9:10 am 
Newbie

Joined: Wed Nov 11, 2009 9:03 am
Posts: 1
Hello, I have a sql-query in hbm file as

Code:
select count(REQUESTID) AS TOTALREQUESTS
       , TO_CHAR(ENTRYDATE, :DFPARAM1) AS ENTRY_DATE FROM
       REQUEST_TABLE WHERE 
       ENTRYDATE  BETWEEN TO_DATE(:FROM_DATE, 'DD.MM.YYYY')
       AND TO_DATE(:END_DATE, 'DD.MM.YYYY')
       GROUP BY TO_CHAR(ENTRYDATE, :DFPARAM1)


Now if you will see the param :DFPARAM1 is used twice, once in select column and another in group by.

Now if i set the param values quer.setString("DFPARAM1","'mm/dd/yyyy'") along with setting all the other params, in hibernate i get this not a group by expression error. the query runs fine from sqlplus.

Please note that with debug on, i see the query converted as ? in place of named parameters.

Any help will be greatly appreciated.


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.