java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list
可能的原因:fetch 与 count 一起使用
select count(o) from Student s left outer join fetch o.clazz
把fetch去掉即可
select count(o) from Student s left outer join o.clazz
或
select count(o) from Student s
本文探讨了在使用Hibernate进行数据库查询时,遇到的'query specified join fetching, but the owner of the fetched association was not present in the select list'错误。主要原因是将fetch关键字与count函数一同使用。解决方案包括移除fetch关键字或调整查询语句结构。
3693

被折叠的 条评论
为什么被折叠?



