This will clearly require overloads on the actual stored procedure classes, as every hierarchical relationship could need to be defined. At the very least, every type argument would require a getter for its Id (except the type that has no children, but which one is that going to be?), and for its parent Id. It might be better to add a new method that can be used to define the relationship between 2 of the result sets independently, so you could do this:
Even easier: make them expressions, so they can be used directly by the row factory. Something like this:
This will clearly require overloads on the actual stored procedure classes, as every hierarchical relationship could need to be defined. At the very least, every type argument would require a getter for its Id (except the type that has no children, but which one is that going to be?), and for its parent Id. It might be better to add a new method that can be used to define the relationship between 2 of the result sets independently, so you could do this: