| 
					
						 Hibernate version:  2.1.8
 
 Full stack trace of any exception that occurs:
 
 21/09/2005 14:31:05 net.sf.hibernate.util.JDBCExceptionReporter 
 SEVERE: ERROR: column "accountdat0_.accounttype" must appear in the GROUP BY clause or be used in an aggregate function
 
 Problem definition:
 I am having problem with grouping by an object in a query. As far as I know this is not achievable automatically. e.g. SELECT account, sum(trx.amount)
  from account join account.trx as trx group by account"
 
 when I attempt group this manually I run into problems with foreign keys as I do not have access to them as properties.
 
  e.g. SELECT account, sum(trx.amount) from account
 join account.trx as trx group by account.id, account.name, account.accounttype, account.accounttype.id, account.accounttype.name"
 
 I was hoping that the "account.accounttype" would resolve to the foreign key but infact it resolves to the id of the accounttype (account.accounttype.id)
 
 Is there a way that I can achieve this grouping? Any help is greatly appreciated. 
					
  
						
					 |