限制find可以用Spring进行所有操作吗? [英] Limit findAll possible with Spring?

查看:74
本文介绍了限制find可以用Spring进行所有操作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Springs自动实现的存储库是否有可能限制findAll方法的结果大小?

Is it possible with Springs auto implemented repositories to limit the result size of the findAll method?

我正在尝试在接口中声明以下内容:

I'm trying to have something like the following declared in the interface:

List<XY> findAllTopTen();

不幸的是,这是行不通的...

Unfortunatelly, it doesn't work (this) way...

推荐答案

通过Pageable作为参数,如下所示:

Pass a Pageable as a parameter like following:

Page<x> findAll(Pageable pageable);

这篇关于限制find可以用Spring进行所有操作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆