代码:
FieldFilter ff = FieldFilter.locked(BaseInfoEntity.class, "^data$");
Criteria cri = services.createCriteria(b);
Pager pager = super.dao().createPager(pageNum, pageSize);
// 或者用Daos.ext
return Daos.ext(super.dao(), ff).query(BaseInfoEntity.class, cri, pager);
日志
23:31:10.425 [main] DEBUG o.n.dao.impl.sql.run.NutDaoExecutor - SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT CRDT_CODE,COMP_NAME,COMP_TYPE,LGL_PRSN,RGST_CAPI,ESTB_DATE,ADDR,FARE_PLC,OPER_TERM_STRT,OPER_TERM_END,OPER_RNG,SIGN_ORGN,APPR_DATE,SIGN_STTS,OV_TYPE,ip_addr,ov_date,ov_rslt FROM AMS_ENT_BASE_INFO WHERE LOWER(COMP_NAME) LIKE LOWER(?)) T WHERE ROWNUM <= 10) WHERE RN > 0
| 1 |
|------------------|
| %海门市海门镇华丰热水器经营部% |
For example:> "SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT CRDT_CODE,COMP_NAME,COMP_TYPE,LGL_PRSN,RGST_CAPI,ESTB_DATE,ADDR,FARE_PLC,OPER_TERM_STRT,OPER_TERM_END,OPER_RNG,SIGN_ORGN,APPR_DATE,SIGN_STTS,OV_TYPE,ip_addr,ov_date,ov_rslt FROM AMS_ENT_BASE_INFO WHERE LOWER(COMP_NAME) LIKE LOWER('%海门市海门镇华丰热水器经营部%')) T WHERE ROWNUM <= 10) WHERE RN > 0 "
23:31:10.572 [main] DEBUG c.a.druid.pool.PreparedStatementPool - stmt enter cache
23:31:10.576 [main] ERROR com.yuro.web.BaseHandler -
org.nutz.dao.DaoException: org.nutz.lang.born.BorningException: Fail to born or cast to 'com.yuro.ams.bean.ent.BaseInfoEntity'
by args: [@(com.alibaba.druid.pool.DruidPooledResultSet@1ef4b2b)]
because:java.lang.ClassCastException: com.alibaba.druid.pool.DruidPooledResultSet cannot be cast to java.util.Map
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:140) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:93) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:82) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.NutDao.query(NutDao.java:483) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_26]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
at org.nutz.dao.util.ExtDaoInvocationHandler$1.run(Daos.java:1093) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.FieldFilter.run(FieldFilter.java:286) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.FieldFilter.run(FieldFilter.java:297) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.util.ExtDaoInvocationHandler.invoke(Daos.java:1109) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at $Proxy21.query(Unknown Source) ~[na:na]
at com.yuro.ams.service.ent.BaseInfoService.query(BaseInfoService.java:60) ~[classes/:na]
at com.yuro.ams.handler.AccountInfoHandler.queryOvRecord(AccountInfoHandler.java:161) ~[classes/:na]
at com.yuro.ams.handler.AccountInfoHandler$$NUTZAOP._aop_invoke(AccountInfoHandler.java:3) [nutz-1.r.63.r4.jar:na]
at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77) [nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57) [nutz-1.r.63.r4.jar:1.r.63.r4]
at com.yuro.log.LogInterceptor.filter(LogInterceptor.java:16) [log-saber-1.0.10.jar:na]
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) [nutz-1.r.63.r4.jar:1.r.63.r4]
at com.yuro.ams.handler.AccountInfoHandler$$NUTZAOP.queryOvRecord(AccountInfoHandler.java:1) [nutz-1.r.63.r4.jar:na]
at com.yuro.ams.handler.AccountInfoHandlerTest.testQuery(AccountInfoHandlerTest.java:47) [test-classes/:na]
at com.yuro.ams.handler.AccountInfoHandlerTest$$NUTZAOP._aop_invoke(AccountInfoHandlerTest.java:3) [nutz-1.r.63.r4.jar:na]
at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77) [nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57) [nutz-1.r.63.r4.jar:1.r.63.r4]
at com.yuro.log.LogInterceptor.filter(LogInterceptor.java:16) [log-saber-1.0.10.jar:na]
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60) [nutz-1.r.63.r4.jar:1.r.63.r4]
at com.yuro.ams.handler.AccountInfoHandlerTest$$NUTZAOP.testQuery(AccountInfoHandlerTest.java:1) [nutz-1.r.63.r4.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_26]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) [junit-4.12.jar:4.12]
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:33) [nutz-plugins-mock-1.r.63.r4.jar:na]
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:14) [nutz-plugins-mock-1.r.63.r4.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12]
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) [junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) [junit-rt.jar:na]
Caused by: org.nutz.lang.born.BorningException: Fail to born or cast to 'com.yuro.ams.bean.ent.BaseInfoEntity'
by args: [@(com.alibaba.druid.pool.DruidPooledResultSet@1ef4b2b)]
because:java.lang.ClassCastException: com.alibaba.druid.pool.DruidPooledResultSet cannot be cast to java.util.Map
at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:25) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.entity.NutEntity.getObject(NutEntity.java:205) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.pojo.PojoQueryEntityCallback$1.createObject(PojoQueryEntityCallback.java:24) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.pager.ResultSetLooping.doLoop(ResultSetLooping.java:75) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.pojo.PojoQueryEntityCallback.invoke(PojoQueryEntityCallback.java:28) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.jdbc.NutPojo.onAfter(NutPojo.java:114) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:277) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:159) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:126) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
... 52 common frames omitted
Caused by: java.lang.ClassCastException: com.alibaba.druid.pool.DruidPooledResultSet cannot be cast to java.util.Map
at org.nutz.mapl.impl.MaplRebuild.injectMap(MaplRebuild.java:189) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.mapl.impl.MaplRebuild.inject(MaplRebuild.java:156) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.mapl.impl.MaplRebuild.injectMap(MaplRebuild.java:220) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.mapl.impl.MaplRebuild.inject(MaplRebuild.java:156) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.mapl.impl.MaplRebuild.cell(MaplRebuild.java:92) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.mapl.Mapl.cell(Mapl.java:56) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at com.yuro.ams.bean.ent.BaseInfoEntity.<init>(BaseInfoEntity.java:122) ~[classes/:na]
at com.yuro.ams.bean.ent.BaseInfoEntity$FC$c90bfb1bcd4882a6037d8f4c91dd4a90.invoke(BaseInfoEntity.java) ~[nutz-1.r.63.r4.jar:na]
at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19) ~[nutz-1.r.63.r4.jar:1.r.63.r4]
... 65 common frames omitted
是用法有问题吗?