hibernate hql语句弄不了。报错了。郁闷中 5
publicActionForwarddisplaymove(ActionMappingmapping,ActionFormform,HttpServletRequest...
public ActionForward displaymove(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)
{
int id=Integer.parseInt(request.getParameter("id"));
//System.out.println("进入displaymove方法"+id);
Session session=HibernateSessionFactory.getSession();
String hql="from YisoulMove ysm where ysm.id=?";
Query query=session.createQuery(hql);
//query.setInteger(0,id);
YisoulMove ym=new YisoulMove();
List it=query.list();
ym=(YisoulMove) it.get(0);
HttpSession session1=request.getSession(false);
session1.setAttribute("displaymove",ym);
return mapping.findForward("displaymove");
}
我设置了。断点:
Query query=session.createQuery(hql); 这一句就报错了。
错误提示是:
严重: Servlet.service() for servlet action threw exception
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
at org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker 展开
{
int id=Integer.parseInt(request.getParameter("id"));
//System.out.println("进入displaymove方法"+id);
Session session=HibernateSessionFactory.getSession();
String hql="from YisoulMove ysm where ysm.id=?";
Query query=session.createQuery(hql);
//query.setInteger(0,id);
YisoulMove ym=new YisoulMove();
List it=query.list();
ym=(YisoulMove) it.get(0);
HttpSession session1=request.getSession(false);
session1.setAttribute("displaymove",ym);
return mapping.findForward("displaymove");
}
我设置了。断点:
Query query=session.createQuery(hql); 这一句就报错了。
错误提示是:
严重: Servlet.service() for servlet action threw exception
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
at org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.java:896)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4819)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1373)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4243)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3725)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1864)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:818)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:604)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker 展开
展开全部
堆栈第一条错误是NoSuchMethodError。 antlr.collections.AST.getLine()
是不是你没有加antlr这个包?
是不是你没有加antlr这个包?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
少方法
少方法
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是不是hql参数设置错了哦
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
没找到方法,估计是少了jar文件 ,找找antlr这个吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询