1
I’m managing to make a simple select, but I don’t know the structure of how to make a select using Join. Follow the code below:
That code works:
@Query(value = "SELECT * FROM tabela1 /*#pageable*/",
countQuery = "SELECT count(*) FROM tabela1",
nativeQuery = true)
Page<ClasseModeloTabela> testePaginacaoQuery(Pageable pageable);
This code does not 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);