Return ResultSet with column names from functions
Consider the example below:

CREATE TABLE test.child (
    id    integer,
    p_id1 integer,
    p_id2 integer
);

CREATE OR REPLACE FUNCTION named_cols() 
RETURNS SETOF test.child 
AS $$
  SELECT 0, 12, 23;                                                                                                                                                                                                 
$$ LANGUAGE sql;

SELECT named_cols();
 named_cols 
────────────
 (0,12,23)


SELECT * FROM named_cols();
 id │ p_id1 │ p_id2 
────┼───────┼───────
  0 │    12 │    23


If you call the function the first way, you will get back a record, without the column names.  It looks like you are after the second one - you would experience the same behaviour with any programming language, not only Java.