NutzCN Logo
问答 这个是哪里的问题?是那个'NULL'吗?
发布于 407天前 作者 qq_ac3cfcfc 540 次浏览 复制 上一个帖子 下一个帖子
标签:

代码:
List records = sql.getList(Record.class);//结果
if (records == null || records.size() < 1)
continue;
for(Record record : records){
record.put("syn_time", new Date());
record.put(".table",stationType.getArrival_report_table());
}
dao_local.fastInsert(records);

错误:
2018-10-29 16:48:18 [DefaultQuartzScheduler_Worker-1] ERROR org.quartz.core.JobRunShell - Job defaultGroup.TaskSynAsomDataStatusBuild threw an unhandled Exception:
org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 00:00:00','NULL',6,'2018-10-29 16:48:18') '
PreparedStatement:
'INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(?,?,?,?,?,?,?) '
CaseMessage=批次处理 0 INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 0:0:0.000000 +8:0:0',NULL,6,'2018-10-29 16:48:18.499000 +8:0:0') 被中止,呼叫 getNextException 以取得原因。
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
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)
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:248)
at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
at org.nutz.dao.impl.NutDao.fastInsert(NutDao.java:189)
at io.longview.asompro.scheduler.jobs.TaskSynAsomDataStatusBuild.execute(TaskSynAsomDataStatusBuild.java:100)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.sql.BatchUpdateException: 批次处理 0 INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 0:0:0.000000 +8:0:0',NULL,6,'2018-10-29 16:48:18.499000 +8:0:0') 被中止,呼叫 getNextException 以取得原因。
at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:133)
at org.postgresql.core.v3.QueryExecutorImpl$ErrorTrackingResultHandler.handleError(QueryExecutorImpl.java:308)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2004)
at org.postgresql.core.v3.QueryExecutorImpl.flushIfDeadlockRisk(QueryExecutorImpl.java:1187)
at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1212)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:351)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:1019)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeBatch(FilterChainImpl.java:2596)
at com.alibaba.druid.filter.FilterAdapter.statement_executeBatch(FilterAdapter.java:2474)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeBatch(FilterEventAdapter.java:279)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeBatch(FilterChainImpl.java:2594)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeBatch(StatementProxyImpl.java:192)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeBatch(DruidPooledPreparedStatement.java:559)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:322)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
... 17 more
2018-10-29 16:48:18 [DefaultQuartzScheduler_Worker-1] ERROR org.quartz.core.ErrorLogger - Job (defaultGroup.TaskSynAsomDataStatusBuild threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 00:00:00','NULL',6,'2018-10-29 16:48:18') '
PreparedStatement:
'INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(?,?,?,?,?,?,?) '
CaseMessage=批次处理 0 INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 0:0:0.000000 +8:0:0',NULL,6,'2018-10-29 16:48:18.499000 +8:0:0') 被中止,呼叫 getNextException 以取得原因。]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 00:00:00','NULL',6,'2018-10-29 16:48:18') '
PreparedStatement:
'INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(?,?,?,?,?,?,?) '
CaseMessage=批次处理 0 INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 0:0:0.000000 +8:0:0',NULL,6,'2018-10-29 16:48:18.499000 +8:0:0') 被中止,呼叫 getNextException 以取得原因。
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
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)
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:248)
at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:50)
at org.nutz.dao.impl.NutDao.fastInsert(NutDao.java:189)
at io.longview.asompro.scheduler.jobs.TaskSynAsomDataStatusBuild.execute(TaskSynAsomDataStatusBuild.java:100)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
... 1 more
Caused by: java.sql.BatchUpdateException: 批次处理 0 INSERT INTO wprd_arrival_report(arrival_report_id,station_id,report_type,observe_time,insert_time,status,syn_time) VALUES(2174926,2782,'101','2018-10-27 0:0:0.000000 +8:0:0',NULL,6,'2018-10-29 16:48:18.499000 +8:0:0') 被中止,呼叫 getNextException 以取得原因。
at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:133)
at org.postgresql.core.v3.QueryExecutorImpl$ErrorTrackingResultHandler.handleError(QueryExecutorImpl.java:308)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2004)
at org.postgresql.core.v3.QueryExecutorImpl.flushIfDeadlockRisk(QueryExecutorImpl.java:1187)
at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1212)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:351)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:1019)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeBatch(FilterChainImpl.java:2596)
at com.alibaba.druid.filter.FilterAdapter.statement_executeBatch(FilterAdapter.java:2474)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeBatch(FilterEventAdapter.java:279)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeBatch(FilterChainImpl.java:2594)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeBatch(StatementProxyImpl.java:192)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeBatch(DruidPooledPreparedStatement.java:559)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:322)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
... 17 more

3 回复

是不是id冲突了

不是id冲突,id采用的是主键自增的,sql里也没有加入id,我把这个sql中'NULL'的单引号去掉就可以插入了,加上单引号就是时间戳的值无校

没看到 'NULL'

把那个属性全部remove掉吧

添加回复
请先登陆
回到顶部