Mustafa Makebits created DELTASPIKE-1247: --------------------------------------------
Summary: Orderby clause added to count query Key: DELTASPIKE-1247 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1247 Project: DeltaSpike Issue Type: Bug Components: Data-Module Affects Versions: 1.7.2 Reporter: Mustafa Makebits Priority: Minor I have the following repository code: {code:title=Bar.java|borderStyle=solid} @Repository public interface PurchaseRequisitionRepository extends EntityRepository<PurchaseRequisition, String>, Serializable { @Query("select e from PurchaseRequisition e") QueryResult<PurchaseRequisition> findAllPurchaseRequisitions(); } {code} And in my service code I'm trying to set the sort order like so: {code} repository.findAllPurchaseRequisitions().withPageSize(pageSize).orderDesc("prrId", false); {code} At some point I do query.countPages() or some thing similar, which causes this sql to be generated: {code} select count(purchasere0_.id) as col_0_0_ from omis_db.purch_requisition purchasere0_ order by purchasere0_.id limit ? {code} which in turn cause a sql exception: {quote} org.hibernate.exception.SQLGrammarException: ERROR: column "purchasere0_.id" must appear in the GROUP BY clause or be used in an aggregate function Position: 96 {quote} Am I doing anything wrong to cause this behavior? is there a way to work around it so that I can set the order and do paging at the same time? -- This message was sent by Atlassian JIRA (v6.3.15#6346)