SQL : Intuitive way for count(*)

Bug #633110 reported by Samppa Saarela
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Querydsl
Fix Released
Medium
Samppa Saarela

Bug Description

Using count(*) in searches is a very common case but in querydsl it's still quite unintuitive. Could there be a shortcut for it?

E.g.

query.list(query.all().count());

or

query.list(SQLCommonQuery.ALL.count());

summary: - Intuitive way for count(*)
+ SQL : Intuitive way for count(*)
Changed in querydsl:
importance: Undecided → Medium
Revision history for this message
Samppa Saarela (samppa-saarela) wrote :

Wildcard can now be used through Wildcard class:

@Test
public void wildcardAll() {
    expectedQuery = "select * from EMPLOYEE2 e";
    query().from(employee).uniqueResult(Wildcard.all);
}

@Test
public void countAll() {
    expectedQuery = "select count(*) as rowCount from EMPLOYEE2 e";
    PNumber<Long> rowCount = new PNumber<Long>(Long.class, "rowCount");
    query().from(employee).uniqueResult(Wildcard.count().as(rowCount));
}

Changed in querydsl:
status: New → Fix Committed
assignee: nobody → Samppa Saarela (samppa-saarela)
Revision history for this message
Timo Westkämper (timo-westkamper) wrote :

Released in 1.9.6

Changed in querydsl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.