-->
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: probs with query
PostPosted: Thu Apr 07, 2005 10:29 am 
Newbie

Joined: Thu Apr 07, 2005 9:30 am
Posts: 1
hi
I am new to Hibernate and have just got a grasp of the basics...
I have added the following tag to my Event.hbm.xml
Code:
<property name="sum"
          formula="(select sum(uid) from Events)"/>

and I have added the sum getter an setter methods. but i always get an error
Quote:
WARN - SQL Error: 0, SQLState: 42803
ERROR - ERROR: column "event0_.uid" must appear in the GROUP BY clause or be used in an aggregate function


which could be because I am already executing a query
Code:
"List result = session.createQuery("from Event").list();"


how do i get around this error and get get the sum from the query in the property tag

thnx for any help
jubs


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 3:33 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Code:
formula="(select sum(e.uid) from Events e group by e.uid)"


This is standard SQL


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.