SGF-131. Fixed count() problem
This commit is contained in:
@@ -12,14 +12,14 @@ import org.springframework.data.gemfire.repository.Wrapper;
|
|||||||
import org.springframework.data.repository.core.EntityInformation;
|
import org.springframework.data.repository.core.EntityInformation;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import com.gemstone.gemfire.GemFireCheckedException;
|
|
||||||
import com.gemstone.gemfire.GemFireException;
|
|
||||||
import com.gemstone.gemfire.cache.Region;
|
import com.gemstone.gemfire.cache.Region;
|
||||||
|
import com.gemstone.gemfire.cache.query.SelectResults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic repository implementation.
|
* Basic repository implementation.
|
||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
|
* @author David Turanski
|
||||||
*/
|
*/
|
||||||
public class SimpleGemfireRepository<T, ID extends Serializable> implements GemfireRepository<T, ID> {
|
public class SimpleGemfireRepository<T, ID extends Serializable> implements GemfireRepository<T, ID> {
|
||||||
|
|
||||||
@@ -135,14 +135,8 @@ public class SimpleGemfireRepository<T, ID extends Serializable> implements Gemf
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long count() {
|
public long count() {
|
||||||
return template.execute(new GemfireCallback<Long>() {
|
SelectResults<Integer> results = template.find("select count(*) from " + template.getRegion().getFullPath());
|
||||||
@Override
|
return (long)results.iterator().next();
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
// TODO: Take into account keySetOnServer()
|
|
||||||
public Long doInGemfire(Region region) throws GemFireCheckedException, GemFireException {
|
|
||||||
return Long.valueOf(region.keySet().size());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user