Hi, I have a feature request to support ORDER BY in COUNT queries.
When I run Hibernate generated query via criteria API I get: org.h2.jdbc.JdbcSQLException: Column "ANMERK1_.ANMTEXT" must be in the GROUP BY list; SQL statement: select count(anmerk1_.anmtext) as col_0_0_ from area area0_ inner join anmerk anmerk1_ on area0_.areanmerk=anmerk1_.anmcd and @lang=anmerk1_.anmsprache where 1=1 order by anmerk1_.anmtext desc [90016-190] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.expression.ExpressionColumn.updateAggregate(ExpressionColumn.java :169) at org.h2.command.dml.Select.queryGroup(Select.java:354) at org.h2.command.dml.Select.queryWithoutCache(Select.java:638) at org.h2.command.dml.Query.query(Query.java:322) at org.h2.command.dml.Query.query(Query.java:290) at org.h2.command.dml.Query.query(Query.java:36) at org.h2.command.CommandContainer.query(CommandContainer.java:90) at org.h2.command.Command.executeQuery(Command.java:196) at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement. java:108) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery( NewProxyPreparedStatement.java:116) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract( ResultSetReturnImpl.java:82) This works in MySql (production) but not in H2 (test). I don't want to remove order by from count query (part of pagination request) just to pass tests, because JPA can produce all kind of joins when ordering via referenced entity (thus possibly increasing number of returned rows). Similar issues: https://jira.grails.org/browse/GRAILS-8162 https://jira.spring.io/browse/DATAJPA-377 https://code.google.com/p/h2database/issues/detail?id=572 -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
