i have this repository, service and controller, and i have no ideea how to solve the error that i m getting in service, any suggestions please? (Type mismatch: cannot convert from List<UtenteDto> to Page<UtenteDto>)
String FILTER_UTENTE_NOME_AND_COGNOME_QUERY = "select b from Utente b where UPPER(b.nome) like CONCAT('%',UPPER(?1),'%') and UPPER(b.cognome) like CONCAT('%',UPPER(?2),'%')";
@Query(FILTER_UTENTE_NOME_AND_COGNOME_QUERY)
List<Utente> findByFirstNameLikeAndLastNameLike(String nomeFilter, String cognomeFilter,Pageable pageable);
public Page<UtenteDto> findByFirstNameLikeAndLastNameLike(String nomeFilter, String cognomeFilter, int page, int size){
Pageable pageable= PageRequest.of(page, size);
return utenteRepository.findByFirstNameLikeAndLastNameLike(nomeFilter,cognomeFilter,pageable)
.stream()
.map(e->mapper.map(e,UtenteDto.class))
.collect(Collectors.toList());
}
@GetMapping("/utenti")
@ResponseStatus(value = HttpStatus.OK)
public Page<UtenteDto> getAllFilteredByNomeAndCognome(@RequestParam(defaultValue = "") String nomeFilter,
@RequestParam(defaultValue = "") String cognomeFilter,
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "30") int size){
AccessTokenAccountRepository repository;
return utenteService.findByFirstNameLikeAndLastNameLike(nomeFilter,cognomeFilter,page,size);
}