Question

I am trying to filter JPA repository

@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 !

Was it helpful?

Solution

In order to use Specifications you need to make your repository extend JpaSpecificationExecutor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top