mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
added count methods
This commit is contained in:
parent
eaf20bdc94
commit
864ea1f0dd
@ -8,6 +8,7 @@ import org.hibernate.Session;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.mysema.query.grammar.HqlGrammar;
|
||||
import com.mysema.query.grammar.HqlOps;
|
||||
import com.mysema.query.grammar.HqlQueryBase;
|
||||
import com.mysema.query.grammar.types.Expr;
|
||||
@ -98,6 +99,14 @@ public class AbstractHqlQuery<A extends AbstractHqlQuery<A>> extends HqlQueryBas
|
||||
}
|
||||
}
|
||||
|
||||
public long count(){
|
||||
return uniqueResult(HqlGrammar.count());
|
||||
}
|
||||
|
||||
public long count(Expr<?> expr){
|
||||
return uniqueResult(HqlGrammar.count(expr));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <RT> RT uniqueResult(Expr<RT> expr) {
|
||||
select(expr);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user