Open
Description
Mark Czubin opened DATAJPA-1644 and commented
When we create a projection query (i.e. use an interface to denote which fields we want to fetch). And the entity of the repo implements the interface as well.
Then we are unable to execute the query in the repository of the entity.
The same query does work in other repositories.
class X implements Y {
... lots of fields
}
interface Y {
String getMyField
}
interface xRepo implements JpaRepository<X, ID> {
@Query("select x.myField as myField from X x")
List<Y> selectProjection();
}
This query yields the following error message:
No converter found capable of converting from type [java.lang.String] to type[@org.springframework.data.jpa.repository.Query Y]
Workaround:
Place the query in a different repository.
Added as attachment a maven project with the problem and workaround.
Attachments:
- demo.zip (108.06 kB)