How to return a select query from jpa repository with foreign key type

I am try to do this:

@Query(value = "SELECT DISTINCT comarca_id FROM debito_negativacao WHERE 
debito_negativacao.status= :status", nativeQuery = true)
List<Comarca> findDistinctComarcaIdByStatus(@Param("status") String status);

But i have this error:

No converter found capable of converting from type [java.math.BigInteger] to type [com.hc.projects.model.Comarca]]

#java #spring-boot #hibernate

3 Likes301.05 GEEK