Prevent confusion if someone uses selectCount() (which returns int) on a
grouped query. They should be using select(Funcs.count(Exps.literal("*")))
(which returns List<Integer>) in such cases.
This commit is contained in:
@@ -359,6 +359,7 @@ public class Query<T extends PersistentRecord>
|
|||||||
*/
|
*/
|
||||||
public int selectCount ()
|
public int selectCount ()
|
||||||
{
|
{
|
||||||
|
checkState(_groupBy == null, "You surely mean to select(Funcs.count(Exps.literal(\"*\"))).");
|
||||||
_fromOverride = new FromOverride(_pclass);
|
_fromOverride = new FromOverride(_pclass);
|
||||||
return _repo.load(CountRecord.class, _cache, getClauseArray()).count;
|
return _repo.load(CountRecord.class, _cache, getClauseArray()).count;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user