hibernate异常Hibernate异常:query specified join fetching, but the owner of the fetched association was n
2013-12-08 10:32
525 查看
项目中想级联查询表中的某些字段发生Hibernate异常:query specified join fetching, but the owner of the fetched association was not present in the select list异常,查了很多资料没有解决最后还是自己乱碰解决了。现记录如下:
new StringBuffer() .append("select new com.jhzy.model.News(n.id, n.title, n.source, n.flag, n.addTime, nt) from News n left join n.newsType nt left join n.user u where ") .append("(nt.name ") .append(" like '%") .append(paramValue) .append("%' or n.source like '%") .append(paramValue) .append("%' or ") .append(" n.title") .append(" like '%") .append(paramValue) .append("%') order by n.flag desc, nt.sequence asc, n.addTime desc")
用new 生成查询对象的时候就不用fetch关键字,但是得在model类中建立相应类型的构造方法。
相关文章推荐
- Hibernate异常:query specified join fetching, but the owner of the fetched association was not present
- 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 sel
- query specified join fetching, but the owner of the fetched association was not present in the select list
- query specified join fetching, but the owner of the fetched association was not present in the selec
- query specified join fetching, but the owner of the fetched association was not present in the selec
- query specified join fetching, but the owner of the fetched association was not present in the selec
- org.hibernate.QueryException: query specified join fetching, but the owner of the fetched associatio
- 【解决Hiberate】 query specified join fetching, but the owner of the fetched association..
- org.hibernate.WrongClassException: Object with id: 3 was not of the specified subclass
- 错误:created a ThreadLocal with key of type ……but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
- Hibernate:a different object with the same identifier value was already associated wit异常解决
- pid.txt CATALINA_PID was set but the specified file does not exit
- The content of the adapter has changed but ListView did not receive a notification 异常解析
- 奇葩问题:This file could not be checked in because the original version of the file on the server was moved or deleted. A new version of this file has been saved to the server, but your check-in comments were not saved
- the message "\$CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop
- 处理The content of the adapter has changed but ListView did not receive a notification异常
- MFC开发遇到的异常Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call
- 解决方案: the selected file is a solution file but was created by a newer version of this application and cannot be opened
- Specified argument was out of the range of valid values. 解决方法