-->
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: BUG??? SUM (field1*field2) doesn't work
PostPosted: Thu Mar 03, 2005 12:21 pm 
Newbie

Joined: Fri Feb 25, 2005 9:37 am
Posts: 3
Hello,

I've got a very wierd error Hibernate, but maybe it's just me....

Query:
Code:
SELECT SUM(field1*field2) FROM... GROUP BY ....


Hibernate parses the query and generates the correct SQL

Code:
select sum(table0_.field1*table0_.field1) as x0_0_ from ...


but then Hibernate crashes with the following error:
java.sql.SQLException: Column 'x1_0_' not found.

Hibernate obviously tries to fetch a second column ....
Probably because of the *

It works fine using
Code:
SUM(field1+field2) ....



Does anyone know what's wrong??

Lars


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 1:27 pm 
Newbie

Joined: Fri Feb 25, 2005 9:37 am
Posts: 3
OK, i found it in a Posting from Gavin :(

Quote:
sum(tperfql.mtvteht * tobjtcm.txevvtettcp1)


HQL doesn't support arithmetic expressions in the select clause :(

Hopefully the new query parser slated for 2.2 will help solve this problem.
[/quote]


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.