getSession().createQuery()发生java.lang.reflect.InvocationTargetException错误
我刚学SSH的,所以不知道什么原因
Spring和Hibernate已经配置好了,我新建一个Junit测试Spring和hibernate工作情况,发现一切正常
ApplicationContext ctx = new FileSystemXmlApplicationContext("XXXXX.xml"); EmpService abccc = (EmpService)ctx.getBean("empService"); System.out.println(abccc.validLogin("123","123"));int result = empService.validLogin(getUserName(), getPassWord());
java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597)
log.debug("finding MgrTable instance by Name And Passworld"); try { String queryString = "from MgrTable as model where model.empName"+ "= ? and model.empPass= ?"; Query queryObject = getSession().createQuery(queryString); queryObject.setParameter(0, name); queryObject.setParameter(1, passWorld); if (queryObject.list().size()>0) { return (MgrTable)queryObject.list().get(0); }else { return null; } } catch (RuntimeException re) { log.error("find by Name And Passworld failed", re); throw re; }