I've not found any similar issue, so I'm creating a new one.
Problem:
The problem is that sometimes native queries are quite complicated, and it is possible that they would return unknown at declaration time number of columns. I'm not saying it is a great way of doing things, but that's just what we have in our case, for instance.
And in this case we cannot really return any kind of projection, since we do not know anything about the structure of the result set being returned at compile time.
Solution (Proposal):
I think it makes sense to consider allowing returning the Map from the repository query method, like:
@Query(value = "...", nativeQuery=true)
Map<String, Object> findSomethingComplex();
In this case, the key is supposed to be the column name, and the value is just a raw column value.
I've not found any similar issue, so I'm creating a new one.
Problem:
The problem is that sometimes native queries are quite complicated, and it is possible that they would return unknown at declaration time number of columns. I'm not saying it is a great way of doing things, but that's just what we have in our case, for instance.
And in this case we cannot really return any kind of projection, since we do not know anything about the structure of the result set being returned at compile time.
Solution (Proposal):
I think it makes sense to consider allowing returning the
Mapfrom the repository query method, like:In this case, the key is supposed to be the column name, and the value is just a raw column value.