Meu caro Mike, tá dificil aprender esse troço, hein! rs
Estou tentando fazer essa query aqui:
@Query(value = "SELECT p.id, p.name, p.age, p.city, p.info, p.state, p.status, p.picture\n" +
"FROM owner_pet as op\n" +
"INNER JOIN lost_pet as p on op.id_pet =?1\n" +
"WHERE op.id_owner =?1", nativeQuery = true)
List<LostPetEntity> find(Integer id);
Mas a exception diz:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object[]] to type [fearx.projects.animal.finder.api.entity.LostPetEntity] for value ‘{1, Dogola, 1, Nova União, /r/ban, RO, NOTICED, defaultvalue}’; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.Integer] to type [fearx.projects.animal.finder.api.entity.LostPetEntity]] with root cause
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.Integer] to type [fearx.projects.animal.finder.api.entity.LostPetEntity]
Pelo que entendi, ele não tá conseguindo converter o que vem para uma LostPetEntity. Todavia, é exatamente essa entidade que me é retornada pela query.
O que posso fazer? Eu consigo retornar se for um Object, mas isso num me ajuda muito