Boa tarde galera, estou apanhando para realizar um select
String sql = "SELECT c.pdfs\\:\\:text as pdf, (c.resultado->>'nome')\\:\\:text as nome,(c.resultado->>'status')\\:\\:text as status, a.datahorafim as data"
+ " FROM header a JOIN santaCatarina b ON a.id = b.header_id"
+ " JOIN parametro c ON b.id = c.id WHERE b.cpfCnpj=:cpfCnpj";
Query query = entityManager.createNativeQuery(sql, entityClass);
List<Object> resultList = query.setParameter("cpfCnpj", cpfCnpj).getResultList();
List<Cnd> listCnd = new ArrayList<Cnd>();
for (Object obj : resultList) {
Cnd cnd = new Cnd();
Object[] obCnd = (Object[]) obj;
cnd.setCpfCnpj(cpfCnpj);
cnd.setPdfs(String.valueOf(obCnd[0]));
cnd.setNome(String.valueOf(obCnd[1]));
cnd.setStatus(String.valueOf(obCnd[2]));
cnd.setData(LocalDateTime.parse(String.valueOf(obCnd[3])));
listCnd.add(cnd);
}
Este Select funciona perfeitamente no postgres, o problema é que ao tentar fazer o select pela aplicação ele pede outros campos no ResultSet, porém eu quero ter somente estes 4 campos em meu ResultSet.
Eu tentei colocar todos os campos que pedia, so que ai ele não me retorna mais um Object e sim a Entidade SantaCatarina, e não me traz os outros 4 campos.