-->
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.  [ 3 posts ] 
Author Message
 Post subject: Using + operator in Select clause
PostPosted: Fri May 28, 2004 12:46 am 
Regular
Regular

Joined: Tue Mar 23, 2004 2:10 am
Posts: 51
Hello,
I am trying to run following query
"Select new com.sequelsys.common.model.scheduling.ValueObject(sum(a.seqNum + a.myNum)) from AppointmentStatusModel a"

The SeqNum and myNum are both java.lang.Long. Hibernate gives me error that + is undefined alias . If i remove + it works ok butr i need to add both columns please help me

Regards,
Shoaib Akhtar


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 28, 2004 3:26 am 
Regular
Regular

Joined: Wed May 12, 2004 3:03 am
Posts: 51
Location: France
Hi,

Why don't you do it like this :

Code:
List result1  = session.find(from AppointmentStatusModel a);
Vector result2 = new Vector();
for (..;..;..){
AppointmentStatusModel a = result1.get(i)
result2.add(new com.sequelsys.common.model.scheduling.ValueObject(sum(a.seqNum + a.myNum));
}


Charles


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 30, 2004 6:34 am 
Regular
Regular

Joined: Tue Mar 23, 2004 2:10 am
Posts: 51
Hello,
Thanks Charles for your reply. I know that i can acheive the results through this way but it will severely hit performance. I need to iterate over all the resulted objects i saw the problem in hibernate Jira i hope that it will soon be resolved. I am using hibernate for quite some tme now and it is the best open source tool i have ever seen and this is the only problem i faced hope it will soon resolve and we can use expressions with aggregate function. Any of hibernate team member can give any time frame of resolution of this problem???
Regards,
Shoaib Akhtar


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