org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list
报这个异常是因为查询时返回的对象不包含有该join fetch后面的对象,因此可以将fetch删除就可以啦。这里的fetch就是将fetch后面的对象setter到查询返回的对象中。因此当不存在包含时,就会该报错!
本文探讨了Hibernate框架中出现的一个特定查询异常:query specified join fetching, but the owner of the fetched association was not present in the select list。解释了该错误产生的原因,并通过一个具体的例子展示了如何避免这种错误。
org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list
报这个异常是因为查询时返回的对象不包含有该join fetch后面的对象,因此可以将fetch删除就可以啦。这里的fetch就是将fetch后面的对象setter到查询返回的对象中。因此当不存在包含时,就会该报错!
3661
9921
1296
283
1815

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