我在 GemFire 地区拥有数百万个对象。我不希望findAll()
执行默认 SDR 查询以一次性检索数百万个对象。我试图弄清楚是否有一种方法可以覆盖默认的 findAll 查询并提供 LIMIT 参数来限制从 GemFire 区域检索到的对象数量。这是我想做的一个例子:
NoRepositoryBean
public interface CrudRepository<T, ID extends Serializable> extends Repository<T, ID> {
/**
* Returns all instances of the type.
*
* @return all entities
*/
Iterable<T> findAll();
}
public interface MyRepository extends CrudRepository<MyRepoObject, String> {
@Query("SELECT * FROM MyRegion LIMIT $1")
Iterable<CellTower> findAll(@Param("limit") String limit);
}
目前,我在 Spring Data Gemfire 1.4.0.BUILD-SNAPSHOT 和 Spring Data REST 2.0.0.BUILD-SNAPSHOT 版本