代码:
public List findAllowance(final String deptname,final String qclx,final String qs) {
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
String sql ="Select a from A as a,B as b where a.grxxZb.grxxid = b.grxxZb.grxxid and b.qcxxZb.qcid in (select qcxx.qcid from C as c where c.dwmc=:dwmc and c.qclx=:qclx and c.qs=:qs and c.sbhdbz='审核')";
//转换查询语句
Query query = session.createQuery(sql);
//设置变量值
query.setString("dwmc", deptname);
query.setString("qclx", qclx);
query.setString("qs", qs);
List list = query.list();
return list;
当执行到 List list = query.list();时抛出上面那个异常.
unexpected token: as [Select.....] nest exception is org.hibernate.QueryException: unexpected token: as [Select....]
这里的两个[Select.....] 内容就上面的sql变量的执行语句.
错误在哪里?
那个sql语句我单独在plsql下执行没问题.
------解决方法--------------------------------------------------------
Select a from A as a,B as b
完全没必要这么写。