-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL Bug (not respecting the alias)
PostPosted: Fri Jan 25, 2013 11:16 am 
Newbie

Joined: Mon Oct 19, 2009 4:33 pm
Posts: 8
This Query:
Code:
SELECT o.periodo, o.cuitEmpresa, sum(o.total) FROM Dj o, Empresas e WHERE o.cuitEmpresa = e.cuit AND o.confirmado=TRUE AND CAST((substring(o.periodo,1, 4) || substring(o.periodo,6, 8)) AS integer) >=201301 AND CAST((substring(o.periodo,1, 4) || substring(o.periodo,6, 8)) AS integer) <=201301 GROUP BY o.periodo, o.cuitEmpresa


throw:
ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: column "dj0_.periodo" must appear in the GROUP BY clause or be used in an aggregate function
Position: 8

and obviously if I add that alias (dj0_) to the field in the GROUP BY throw another error.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.