[英]How to filter JPA repository?
I am trying to filter JPA repository 我正在尝试过滤JPA存储库
@RequestMapping("/search")
public String search(@ModelAttribute Person search, Model model) {
PersonSpecifications spec = new PersonSpecifications();
model.addAttribute("people", this.hotelRepository.findAll(spec.lastNameIsLike("Foo")));
return "people/list";
}
And got the following error 并得到以下错误
The method findAll(Iterable<Long>) in the type CrudRepository<Person,Long> is not applicable for the arguments (Specification<Person>)
Please advise. 请指教。 Thanks ! 谢谢 !
为了使用Specification
您需要使您的存储库扩展JpaSpecificationExecutor
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.