项目框架 SpringMVC+Hibernate
开发工具 Myeclipse10
报错代码(下图):
检查项目发现出现问题的原因:配置文件有问题,少配置了一个字段,下面红色注释部分。
<fields>
a.id,a.title,a.author,a.content,a.source,a.createDate,a.releaseDate,(select name from BDic b where b.id=a.audit),(select name from BDic b where b.id=a.release),a.status,(select name from BDic b where b.id=a.type),b.id,c.id,d.id,a.newType,a.contentPicture,a.targetUrl,a.kind
</fields>
配置上缺少的字段,再次运行OK。
以下为部分完整代码段:
getList getList id,title,author,content,source,createDate,releaseDate,audit,release,status,type,topic.id,channel.id,conference.id,newType,contentPicture,targetUrl,kind a.id,a.title,a.author,a.content,a.source,a.createDate,a.releaseDate,(select name from BDic b where b.id=a.audit),(select name from BDic b where b.id=a.release),a.status,(select name from BDic b where b.id=a.type),b.id,c.id,d.id,a.newType,a.contentPicture,a.targetUrl,a.kind from News a left join a.topic b left join a.channel c left join a.conference d a.id = ? a.title like ? a.author like ? a.source like ? a.audit like ? cn.digitalpublishing.po.News