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()
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()
...全文
相关推荐
hibernate的HQL的模糊查询
总结的hql的查询,感觉很实用 已经写成.java格式,直接复制到项目中就能看了
hql模糊查询hql模糊查询
hql模糊查询hql模糊查询hql模糊查询hql模糊查询
hibernate的分页模糊查询功能
在web项目中,显示数据一般采用分页显示的,在分页的同时,用户可能还有搜索的需求,也就是模糊查询,所以,我们要在dao写一个可以分页并且可以动态加条件查询的方法。接下来通过本文给大家介绍下
hibernate查询
hibernate查询,结合hibernate的模糊查询,等其他总结。
Hibernate操作
Hibernate操作Hibernate操作Hibernate操作


Web 开发
