-->
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.  [ 4 posts ] 
Author Message
 Post subject: aggregate function expected before ( in SELECT
PostPosted: Sun Feb 27, 2005 1:23 pm 
Newbie

Joined: Sun Feb 27, 2005 1:16 pm
Posts: 1
Hi,
I am trying to add two fields in select and getting this message. Any help is appreciated.

Select new Item( item.name,(item.amount+item.tax))
from item

On executing this I am getting the following error

aggregate function expected before ( in SELECT

Can we use "+" operator in select clause


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 6:04 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
I believe you cannot use '+' in select.
Look at the 'formula' attribute in property (.hbm).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 9:28 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Are you try
Select new Item( item.name,item.amount+item.tax)
from item

or simple add getter in POJO like
getTotal() {
return amount + tax;
}

regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 1:23 pm 
Newbie

Joined: Fri Apr 16, 2004 9:27 am
Posts: 18
Location: Russia, Spb
You might be use derived property if needs.

Code:
<property name="total" formula="AMOUNT + TAX" type="integer"/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.