Issue
I'm trying to get a Resultset from a Postgres sql function:
CREATE OR REPLACE FUNCTION "core"."tablesync"("_parameter" varchar)
RETURNS TABLE("id" int4, "par_type" int4, "parent" int4, "name" varchar, "par_value" varchar, "category" int4) AS $BODY$
select prm.id,prm.par_type,prm.parent,prm.name,prm.par_value,prm.category from parameter prm
where par_type = _parameter::int;
--select a.col1, a.col2, b.col3 from table a
--join table2 as b on a.col1 = b.col1;
$BODY$
LANGUAGE sql STABLE
COST 100
ROWS 1000
When that function is executed from sql query the following result is returned:
Then I need to get same result in java with code below:
@Repository
public class SyncRepositoryImpl implements SyncRepository {
@Autowired
private EntityManager entityManager;
@Override
public ArrayList syncTable(JsonNode model) {
ArrayList dataSync = (ArrayList)entityManager.createNativeQuery("select * from core.tablesync('8')").getResultList();
return dataSync;
}
But in debug mode shows me that is void array. Any idea what is happening?.
Thanks for the help.
Solution
I specify scheema in sql code and it works
Answered By - AndresChica
Answer Checked By - Marie Seifert (JavaFixing Admin)