String year) {
Session session = sessionFactory.getCurrentSession();
StringBuilder hql = new StringBuilder();
hql.append("select new pointId,pointName,subStr(repairOffDate,1,6),sum(repairTime),avg(repairTime)");
hql.append("from FrameRepairInfo where lineNo = :lineNo and year = :subStr(repairOffDate,1,6)");
//year不是实体类里的字段,是从repairOffDate截取出来的年份
hql.append("group by pointId,pointName,subStr(repairOffDate,1,6)");
hql.append("order by pointId,pointName,subStr(repairOffDate,1,6)");
Query query = session.createQuery(hql.toString());
List
return list;
}
以上是我写的语句,但是一直报错,找不到原因,求指导
错误:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: expecting OPEN, found ',' near line 1, column 19 [select new pointId,pointName,subStr(repairOffDate,1,6),sum(repairTime),avg(repairTime)from cn.ghac.gmes.bizcom.model.FrameRepairInfo where lineNo = :lineNo and year = :subStr(repairOffDate,1,6)group by pointId,pointName,subStr(repairOffDate,1,6)order by pointId,pointName,subStr(repairOffDate,1,6)]
到底是哪里错了呢!
谢谢大家!