I'm querying a record from oracle using native sql query. The record has child one-to-many records and those child records has it's own set of childs. I'm using good old joins to retrieve necessary information. But is there an easy and elegant way to transform this resultset to java object model to iterate?
Asked
Active
Viewed 535 times
0
-
1Maybe jOOQ is overkill for you, but it does this: https://stackoverflow.com/a/38239895/14955 – Thilo May 22 '18 at 10:10
-
@Thilo thank you, will check that out anyway. – johnny-b-goode May 22 '18 at 10:19
-
1Elegant, it depends, but there are solution in good old JDBC to do that yes. All you need to do it to iterate the `ResultSet` and to identifiy the instances in which to add each childs. Using a `Map
` would be a simple but not always optimal solution. I prefer ordering the result so that each time the ID change, I know I need to create a new instance.... there is multiple solution, if you can provide a [mcve], I could write you some ideas. – AxelH May 22 '18 at 10:32