I have the Client entity that extends Person:
@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 do this query, taking the name that is in another table physically in the database, being in the Client entity through inheritance.