GridGain中是否有计数查询?
GridCacheQuery<Map.Entry<Long, Person>> qry =
queries.createSqlQuery(Person.class, "select count() from Person where street = ?");
int count = qry.execute("streetname").get();
答案 0 :(得分:1)
尝试SQL字段查询,可以选择特定列而不是整个类:
GridCacheQuery<List<?>> qry = queries.createSqlFieldsQuery(
"select count() from Person where street = ?");
Collection<List<?>> rows = qry.execute("streetname").get();
List<?> firstRow = rows.get(0);
int count = (Integer)firstRow.get(0);