`
xq30397022
  • 浏览: 12963 次
  • 性别: Icon_minigender_1
  • 来自: 天津
文章分类
社区版块
存档分类
最新评论

org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: * near line 1, column

阅读更多

在执行这个方法时:

public List<Sendnews> selectSNbyUid(int id) {
String sql = "select * from Sendnews s where s.isdel not in (1,2) and s.newid in (select n.newid from News n where n.uid=? and n.ispublic=1 and n.isdel not in(1,2))";
return getHibernateTemplate().find(sql, id);
}

报如下错误:

org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: * near line 1, column 8 [select * from com.oa.pojo.Sendnews s where s.isdel not in (1,2) and s.newid in (select n.newid from com.oa.pojo.News n where n.uid=? and n.ispublic=1 and n.isdel not in(1,2))];

后来发现报这个错的都是因为hql语句中有非法字符,比如次语句中的*
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics