您的位置:首页 > 产品设计 > UI/UE

query specified join fetching, but the owner of the fetched association was not present in the selec

2017-02-23 21:53 288 查看

query specified join fetching, but the owner of the fetched association was not present in the select list

在使用EntityGraph查询时报了这个错误,它的意思是说
@EntityGraph
中制定的某个属性没有在结果集中出现。该方法的代码如下:

@EntityGraph(attributePaths={"staff"},type=EntityGraphType.FETCH)
@Query("from Account")
public List<Account> findAll();


后来发现查询出来的结果集中,会出现
staff
为空的记录,因此只需要将查询语句改成
@Query("from Account where staff != null")
就能解决该问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jpa EntityGrap
相关文章推荐