The structure below works perfectly, but when I send in the input and pagination data the sort command of the Sql error, what do I need to put in the query to accept the sort by the field I want?
I am sending this data via URL: dadosEntrada?page=0&size=10&sort=campoDoSort
@Query(value = "select i.* " + "from tabela1 r "
+ "join tabela2 ri on ri.chavetabela2 = r.chavetabela1 "
+ "join tabela3 i on i.chavetabela3 = ri.chavetabela2 "
+ "where r.campo1 = ?1 or i.campo2 = ?2 /*#pageable*/ ",
countQuery = "SELECT count(*) "
+ "from tabela1 r "
+ "join tabela2 ri on ri.chavetabela2 = r.chavetabela1 "
+ "join tabela3 i on i.chavetabela3 = ri.chavetabela2 "
+ "where r.campo1 = ?1 or i.campo2 = ?2 ",
nativeQuery = true)
public Page<ClasseModeloTabela> testePaginacaoQueryJoin(Long campo1, Long campo2, Pageable pageable);