-->
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: HQL conversion error when extract day
PostPosted: Sun Aug 28, 2005 9:39 pm 
Newbie

Joined: Wed Nov 12, 2003 1:11 pm
Posts: 3
Location: Brazil
Hi all,

I'm using Hiberbate 3.0.5 and Firebird 1.5.2.

I need a sql that returns the first day of a month. I wrote the follow HQL:

Code:
select ccb.data - day(ccb.data) + 1 from CompraCombustivel ccb

The translation is perfect and SQL is executed by Firebird with no error. But when I try to get the result:

Code:
ScrollableResults sr = query.scroll();
while ( sr.next() ) {
...

the program throws:

Code:
22:05:13,984 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: 07006
22:05:13,984 ERROR [JDBCExceptionReporter] Error converting to int.
java.lang.RuntimeException: org.hibernate.exception.SQLGrammarException: could not read next row of results

What is happing? Is Hibernate "thinking" this SQL returns a integer because the day() function? Is there a way to avoid this?

Rgds,

Leandro


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.