I'm getting a simple select, but I do not know the structure of how to do a select using join. Here is the code below:
This code works:
@Query(value = "SELECT * FROM tabela1 /*#pageable*/",
countQuery = "SELECT count(*) FROM tabela1",
nativeQuery = true)
Page<ClasseModeloTabela> testePaginacaoQuery(Pageable pageable);
Does not this code work the syntax is wrong?
@Query(value = "select i.* " + "from tabela1 r
/*#pageable*/"
+ "join tabela2 ri on ri.chavetabela2 =
r.chavetabela1 "
+ "join tabela3 i on i.chavetabela3 =
ri.chavetabela2"
+ "where r.NR_campo1 = ?1 or i.campo2 =?2 ",
countQuery = "SELECT count(*) FROM tabela1",
nativeQuery = true)
public Page<ClasseModeloTabela> testePaginacaoQueryJoin(Long campo1,
Long campo2, Pageable pageable);