Closed
Description
Consider the following query:
@Entity
class Person { … }
class PersonProjection { … }
@Query("SELECT p FROM Person p")
PersonProjection findBy(…)
The query selects items from the Person entity while its return type is a DTO projection.
It would be good to rewrite such queries to use DTO projections for matching properties along the lines of:
@Query("SELECT new com.acme.PersonProjection(p.firstName, p.lastName) FROM Person p")
PersonProjection findBy(…)