NutzCN Logo
问答 nutz 自定义sql 空指针
发布于 2430天前 作者 _Yuuki 1974 次浏览 复制 上一个帖子 下一个帖子
标签:
    shareRecord.setGrade(aClass.getGrade());
        Sql sql = Sqls.create("INSERT INTO e_share_record (hid,grade,star,listen,ut,delFlag,ct) SELECT @hid,@grade,0,0,NOW(),0,NOW() FROM DUAL WHERE NOT EXISTS (SELECT hid FROM e_share_record WHERE hid=@hid);");
        sql.setParam("hid",hid).setParam("grade",aClass.getGrade());
        sql.setCallback(Sqls.callback.maps());
        dao.execute(sql);
        List<Map> list = sql.getList(Map.class);
        logger.debug("sql boolean : {}",list.size());
 For example:> "INSERT INTO e_share_record (hid,grade,star,listen,ut,delFlag,ct) SELECT 5,1,0,0,NOW(),0,NOW() FROM DUAL WHERE NOT EXISTS (SELECT hid FROM e_share_record WHERE hid=5);"
2018-03-29 10:42:31 [http-nio-8080-exec-1] WARN  org.nutz.mvc.impl.processor.FailProcessor -Error@/api/stu/community/share :
org.nutz.dao.DaoException: java.lang.NullPointerException
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:115)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:1008)
	at com.jiguan.readingaloud.modules.app.service.impl.AppStudentServiceImpl.shareRecord(AppStudentServiceImpl.java:273)
	at com.jiguan.readingaloud.modules.app.service.impl.AppStudentServiceImpl$$NUTZAOP._aop_invoke(AppStudentServiceImpl.java:1)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at com.jiguan.readingaloud.modules.app.service.impl.AppStudentServiceImpl$$NUTZAOP.shareRecord(AppStudentServiceImpl.java:1)
	at com.jiguan.readingaloud.modules.app.controllers.AppStudentModule.shareRecord(AppStudentModule.java:140)
	at com.jiguan.readingaloud.modules.app.controllers.AppStudentModule$FM$shareRecord$f6a788067c38a53cd2ff6f58e8ba76c7.invoke(AppStudentModule.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:30)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.jiguan.readingaloud.common.processor.VerifyTokenProcessor.process(VerifyTokenProcessor.java:39)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.jiguan.readingaloud.common.processor.CrossProcessor.process(CrossProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at com.jiguan.readingaloud.common.processor.LogProcessor.process(LogProcessor.java:20)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: null
	at org.nutz.dao.impl.sql.callback.QueryMapCallback.invoke(QueryMapCallback.java:21)
	at org.nutz.dao.impl.sql.NutSql.onAfter(NutSql.java:137)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:310)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
	... 60 common frames omitted

dao.execute(sql);报空指针了。。为什么啊

添加回复
该帖子已被锁定,不能回复.
回到顶部