hibernate模糊查询问题,hql语句
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()