hibernate模糊查询问题,hql语句

baojunhu999 baojunhu999 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
public List<ZdryjcxxMxpz> search(String zdryxm){
Session session = hibernateTemplate.getSessionFactory().openSession();
String hql="FROM ZdryjcxxMxpz t where t.zdryxm like :zdryxm";
Query q = session.createQuery(hql);
q.setString("zdryxm","%"+zdryxm+"%");
return q.list();
}

报的错误:
java.lang.NullPointerException
at com.egf.qingbao.dzda.service.impl.ZdryjcxxServiceImpl.search(Unknown Source)
at com.egf.qingbao.dzda.service.impl.ZdryjcxxServiceImpl$$FastClassByCGLIB$$88fc492b.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at com.egf.qingbao.dzda.service.impl.ZdryjcxxServiceImpl$$EnhancerByCGLIB$$e23c1301.search()
at com.egf.qingbao.dzda.web.action.ZdryjcxxAction.search(Unknown Source)
at com.egf.qingbao.dzda.web.action.ZdryjcxxAction$$FastClassByCGLIB$$fcd6f49.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at com.egf.qingbao.dzda.web.action.ZdryjcxxAction$$EnhancerByCGLIB$$3f9d39d5.search()
...全文
评论 8
收藏 已收藏
分享
返回顶部
baojunhu999
Web 开发 81,107 成员 341,720 内容