title: How to convert result set of a query to pojo classes which can further be parsed to create json?
body: <p>I have a requirement where in i've a complex db query returning certain result set. I have to map the result to POJO. How can i achieve this with an optimized code? Finally I have to parse the pojo to create a json (json schema is pasted below).</p>
  
  <p><a href="https://i.stack.imgur.com/62Qqf.jpg" rel="nofollow noreferrer">db_objects_json_schema_image</a></p>
  
  <p>Example of query result set (pipe separated):</p>
  
  <p><strong>object_id|object_name|object_owner|object_type|status|parent_id|last_modified_timestamp</strong>
  123_S1|ABC_S1|XYZ_S1|schema|valid|none|2019-11-09_20:40:11
  123_S1T1|ABC_S1T1|XYZ_S1T1|table|valid|123_S1|2019-11-09_20:40:11
  123_S1T1C1|ABC_S1T1C1|XYZ_S1T1C1|column|valid|123_S1T1|2019-11-09_20:40:11
  123_S1T1C2|ABC_S1T1C2|XYZ_S1T1C2|column|valid|123_S1T1|2019-11-09_20:40:11
  123_S1T1C3|ABC_S1T1C3|XYZ_S1T1C3|column|valid|123_S1T1|2019-11-09_20:40:11
  123_S1T2|ABC_S1T2|XYZ_S1T2|table|valid|123_S1|2019-11-09_20:40:11
  123_S1T2C1|ABC_S1T2C1|XYZ_S1T2C1|column|valid|123_S1T2|2019-11-09_20:40:11
  123_S1T2C2|ABC_S1T2C2|XYZ_S1T2C2|column|valid|123_S1T2|2019-11-09_20:40:11
  123_S1T2C3|ABC_S1T2C3|XYZ_S1T2C3|column|valid|123_S1T2|2019-11-09_20:40:11
  123_S1V1|ABC_S1V1|XYZ_S1V1|view|valid|123_S1|2019-11-09_20:40:11
  123_S1V1C1|ABC_S1V1C1|XYZ_S1V1C1|column|valid|123_S1V1|2019-11-09_20:40:11
  123_S1V1C2|ABC_S1V1C2|XYZ_S1V1C2|column|valid|123_S1V1|2019-11-09_20:40:11
  123_S1V1C3|ABC_S1V1C3|XYZ_S1V1C3|column|valid|123_S1V1|2019-11-09_20:40:11
  123_S1V2|ABC_S1V2|XYZ_S1V2|view|valid|123_S1|2019-11-09_20:40:11
  123_S1V2C1|ABC_S1V2C1|XYZ_S1V2C1|column|valid|123_S1V2|2019-11-09_20:40:11
  123_S1V2C2|ABC_S1V2C2|XYZ_S1V2C2|column|valid|123_S1V2|2019-11-09_20:40:11
  123_S1V2C3|ABC_S1V2C3|XYZ_S1V2C3|column|valid|123_S1V2|2019-11-09_20:40:11</p>
  
  <p>PS: I tried row mapper approach but confused on how to maintain parent-child relationships like a schema can have list of tables/views. Similarly a table/view can have multiple columns.</p>