У меня две организации: Produit и Projet. Produit связан с Projet отношениями manyToOne. Я пытаюсь получить все продукты с одним и тем же ProjetId, поэтому я создал в ProduitResource функцию:
@GetMapping("/produits/projet/{id}")
public ResponseEntity<List<ProduitDTO>> getAllProjetProducts(@PathVariable Long id,Pageable pageable) {
log.debug("REST request to get a page of Produits");
Page<ProduitDTO> page = produitService.findAllByProjetProducts(id,pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
in produitService
/**
* Get all the produits.
*
* @param pageable the pagination information.
* @param id the id of the entity.
* @return the list of entities.
*/
Page<ProduitDTO> findAllByProjetProducts(Long id,Pageable pageable);
and in ProduitRepository:
@Query("from ProduitDTO WHERE projetId = ?1")
Page<ProduitDTO> findAllByProjectId(Long id,Pageable pageable);
but when i add to ProduitServiceImp
@Override
public Page<ProduitDTO> findAllByProjectProducts(Long id, Pageable pageable) {
return produitRepository.findAllByProjectId(id, pageable).map(produitMapper::toDto);
}
Я получаю следующую ошибку: "type несоответствие, невозможно преобразовать со страницы в страницу !! "