Pergunta

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 !

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top