Creatre a field in your RowMapper - Map. When you parse result place each the Model items also in the map where key is the item's id.
To add a child to appropriate parent read the parent Model element from the map by parent id of curretn item.
2 things to mention
Root element has no parent. Your query should provide correct order (parent must be processed first)