0
Guys, I have the entity Client that extends Pessoa:
@Entity
@Table(name = "cliente")
@PrimaryKeyJoinColumn(name="id_pessoa")
@Document(indexName="cliente")
public class Cliente extends Pessoa implements Serializable {
Person has the attribute:
@Column(name = "nm_pessoa")
private String nome;
In my repository I have:
public interface ClienteRepository extends JpaRepository<Cliente,Long> {
//Esse metodo funciona
Page<Cliente> findById(Long id, Pageable pageable);
/*Esse método não retorna nada já que no banco de dados
os dados estão na outra tabela: pessoa
*/
@Query("SELECT c FROM Cliente c where c.nome like :nome%") //missing order by clause
Page<Cliente> findByNomeStartingWithOrderByNomeAsc(@Param("nome") String nome, Pageable pageable);
How can I make this query, taking the name that is in another table physically in the database, being in the entity Client through inheritance.
Mark the question as solved.
– Isaias Tavares