@QueryProjection
public PEntity(Long id, Object... custom)
ConstructorExpression<PEntity> expr = QPEntity.create(PEntity.class,
selectExprs.toArray(new Expression[selectExprs.size()]));
query
.distinct()
.list(expr);
Now I'd like to select count for the same query, how can I do this?
I was hoping to just replace .list(expr) with .singleResult(expr.count()) or .singleResult(expr.countDistinct()),
but ConstructorExpression doesn't have count methods.
Maybe it's possible somehow to get count for entire JPAQuery instance?
Something like "select count(*) from (JPAQuery) t;" ?
But I was talking about count distinct.I can't just do query.countDistinct() because I need number of unique rows among these specific columns and not just among primary keys of some entity.What I was trying to say is that I can select distinct multiple columns using .list() and ConstructorExpression, but I can't select count distinct for this query.And looks like none of the proposed solutions work for this case, am I right?
--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.