spring data jpa @query 支持投影吗?

问题描述 投票:0回答:1

spring boot版本:1.5.10,spring data jpa 1.11.10

在我的 MyEntityRespostory 中:

 Page<MyEntityPro> findByName(String name,Pageable pageable ) // working

 @("select e from MyEntity e")
 Page<MyEntity> search1(Pageable pageable) // working

 @("select e from MyEntity e")
 Page<MyEntityPro> search2(Pageable pageable) //error-No aliases found in result tuple! Make sure your query defines aliase

我搜索了错误并发现:问题DATAJPA-885

java spring spring-boot spring-data-jpa projection
1个回答
0
投票

如果使用上层查询关键字,就会导致问题。

....
@query("SELECT e FROM MyEntity") // bug
......
@query("select e from MyEntity") // working
...
© www.soinside.com 2019 - 2024. All rights reserved.