Have a query, let it be
select 1 "colName"
I want to map the result to a POJO type using Spring Data JPA.
Thus the picture is:
public interface MyAwesomeSuperInterface extends CrudRepository {
@Query(value = "select 1 \"colName\"", nativeQuery = true)
List<POJO> something();
}
And the question is HOW to map it to the POJO.class
?
Following the common suggestions I assume I'll get:
- No, I don't want to change it to JSQL and do a 'new POJO'.
- Why? Because I have a complex sql query, which isn't reflectable to JSQL.
- No, I will not bring up the query. I merely want to know how to map the upper example to a POJO using
Spring Data
. Thank you