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

来源:互联网 发布:tomcat 默认端口 编辑:程序博客网 时间:2024/06/05 12:00

在执行这个方法时:

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语句中有非法字符,比如次语句中的*
原创粉丝点击