日期:2014-05-18 浏览次数:20728 次
SessionFactory sessionFactory=new AnnotationConfiguration().configure().buildSessionFactory();
Session session=sessionFactory.getCurrentSession();
session.beginTransaction();
boolean flag=(Boolean)session.createQuery("from EmpDTO emp where emp.emp_name=? and emp.emp_pwd=?")
.setString(1, emp.getEmp_name()).setString(2, emp.getEmp_pwd()).uniqueResult();
session.getTransaction().commit();
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy7.createQuery(Unknown Source)
at hibernate.dao.EmpDAO.verify(EmpDAO.java:21)
at hibernate.dao.EmpDAO.main(EmpDAO.java:34)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
... 3 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl/BitSet;)V
at org.hibernate.hql.antlr.HqlBaseParser.selectClause(HqlBaseParser.java:1391)
at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1106)
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:702)
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:296)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:159)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:274)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1651)
... 8 more