List equipmentList=equipmentDAO.getHibernateTemplate().find("sql");空指针异常
java.lang.NullPointerExceptioncom.action.equipmentAction.equipmentMana(equipmentActio...
java.lang.NullPointerException
com.action.equipmentAction.equipmentMana(equipmentAction.java:61)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
前面还有String sql="from TEquipment where del='no'"; 展开
com.action.equipmentAction.equipmentMana(equipmentAction.java:61)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
前面还有String sql="from TEquipment where del='no'"; 展开
1个回答
展开全部
你这个 find() 里面的应该跟一条正规的语句,你这个是一个字符串 "sql" 肯定不对,应该是 find(sql) 不需要拿双引号引起来,如果引起来就是说传 "sql" 这三个字符进去而不是那条语句
追问
String sql="from TZhuhu where del='no'";
追答
List equipmentList=equipmentDAO.getHibernateTemplate().find("sql");
这是你问题里面的,你得改成
List equipmentList=equipmentDAO.getHibernateTemplate().find(sql);
你要传的是 sql 的语句,而不是这三个字符,不能加引号
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询