任何人都可以在这个查询中告诉我弹簧数据投影警告的原因吗?

任何人都可以在这个查询中告诉我弹簧数据投影警告的原因吗?

问题描述:

我有以下查询:任何人都可以在这个查询中告诉我弹簧数据投影警告的原因吗?

@Query("select c.status from Component c where c.id = ?1") 
ComponentStatus findStatusByComponentId(ComponentId id); 

为什么IntelliJ警告我:“组件”域类型或有效投影接口这里预期?

任何人都可以帮助我吗?

+0

更新:当我将查询名称更改为'xfindStatusByBundleId'时,警告消失。为什么? –

可能是因为它违背了Spring Data所预期的模式。你可以做这样的查询(东西):

ComponentStatus findStatusById(ComponentId id); 

你不需要写查询。

+0

我按照你的建议做了,不工作,警告仍然存在:/ –

+0

运行时错误是什么? – voliveira89