这个代码是其他人写,我刚刚接手过来的,我们总共有100多个pojo类,需要写成通用的处理逻辑因此需要使用拼接字符串的方式来处理,
我直接执行如下的sql,不会报错:
insert into resourcedba.FiberConverter
(RESOURCEID,
ID,
DeviceID,
OriginalID,
Name,
TypeCode,
SubTypeCode,
Status,
IsAsset,
FirstRunningTime,
MaintenanceExpiresTime,
Vendor,
SN,
Brand,
Model,
AreaCode,
UseCorporation,
UseDepartment,
OperateCorporation,
OperateDepartment,
OperateGroup,
Location,
UsePurpose,
TechniqueCode,
TechniQueName,
SetPointCode,
PositionCode,
Description,
CreateBy,
CreateTime,
CreateSource,
UpdateBy,
UpdateTime,
IsFixedAsset,
FixedAssetID,
Administrator,
PortType,
Speed,
PortNum)
values
(RESOURCEDBA.SEQ_RESOURCEID.nextval,
'99-0306-2016-001000',
'99-0306-2016-001000',
'99-0306-2016-001000',
'testNULL',
'03',
'0306',
'00',
'0',
to_date('2016-08-05 15:42:19', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2016-08-05 15:44:55', 'yyyy-mm-dd hh24:mi:ss'),
'供应商供应商供应商供应商供应商',
'产品序列号产品序列号产品序列号产品序列号产品序列号',
'品牌品牌品牌品牌品牌品牌品牌品牌品牌品牌品牌',
'配置型号配置型号配置型号配置型号配置型号',
'99',
'99',
'317BE9B0F04D8DCCE050007F01003E55',
'99',
NULL,
'运维(保管)班组运维(保管)班组运维(保管)班组',
'配置位置配置位置配置位置配置位置配置位置配置位置配',
'用途概述用途概述用途概述用途概述',
'工艺(功能)编码工艺(功能)编码',
'工艺(功能)名称工艺(功能)名称',
'安装点标识码安装点标识码',
'位置标识码位置标识码',
'备注备注备注备注备注备注备注备注备注备注备注备注',
'7D0CC2EB8B87458C833B379903C099BF',
to_date('2016-08-05 15:42:06', 'yyyy-mm-dd hh24:mi:ss'),
NULL,
'4F3FCD5694B040A28E43E52B97684357',
to_date('2016-08-18 17:32:23', 'yyyy-mm-dd hh24:mi:ss'),
'0',
NULL,
'35EE730FB37073A0E050007F0100D26C',
'ST',
'98610549861054986105498610549861054986105498610549',
'98610549861054986105498610549861054986105498610549')
异常信息如下:
2016-08-18 17:34:01,723 DEBUG [dao.impl.sql.run.NutDaoExecutor] - insert into resourcedba.FiberConverter(RESOURCEID,ID,DeviceID,OriginalID,Name,TypeCode,SubTypeCode,Status,IsAsset,FirstRunningTime,MaintenanceExpiresTime,Vendor,SN,Brand,Model,AreaCode,UseCorporation,UseDepartment,OperateCorporation,OperateDepartment,OperateGroup,Location,UsePurpose,TechniqueCode,TechniQueName,SetPointCode,PositionCode,Description,CreateBy,CreateTime,CreateSource,UpdateBy,UpdateTime,IsFixedAsset,FixedAssetID,Administrator,PortType,Speed,PortNum) values(RESOURCEDBA.SEQ_RESOURCEID.nextval,'99-0306-2016-001000','99-0306-2016-001000','99-0306-2016-001000','testNULL','03','0306','00','0',to_date('2016-08-05 15:42:19', 'yyyy-mm-dd hh24:mi:ss'),to_date('2016-08-05 15:44:55', 'yyyy-mm-dd hh24:mi:ss'),'供应商供应商供应商供应商供应商','产品序列号产品序列号产品序列号产品序列号产品序列号','品牌品牌品牌品牌品牌品牌品牌品牌品牌品牌品牌','配置型号配置型号配置型号配置型号配置型号','99','99','317BE9B0F04D8DCCE050007F01003E55','99',NULL,'运维(保管)班组运维(保管)班组运维(保管)班组','配置位置配置位置配置位置配置位置配置位置配置位置配','用途概述用途概述用途概述用途概述','工艺(功能)编码工艺(功能)编码','工艺(功能)名称工艺(功能)名称','安装点标识码安装点标识码','位置标识码位置标识码','备注备注备注备注备注备注备注备注备注备注备注备注','7D0CC2EB8B87458C833B379903C099BF',to_date('2016-08-05 15:42:06', 'yyyy-mm-dd hh24:mi:ss'),NULL,'4F3FCD5694B040A28E43E52B97684357',to_date('2016-08-18 17:32:23', 'yyyy-mm-dd hh24:mi:ss'),'0',NULL,'35EE730FB37073A0E050007F0100D26C','ST','98610549861054986105498610549861054986105498610549','98610549861054986105498610549861054986105498610549')
2016-08-18 17:34:01,724 DEBUG [dao.impl.sql.run.NutDaoExecutor] - SQLException
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedStatement.java:4591)
at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:4578)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setNull(OraclePreparedStatementWrapper.java:1285)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.setNull(DruidPooledPreparedStatement.java:266)
at org.nutz.dao.jdbc.Jdbcs$Adaptor$1.set(Jdbcs.java:251)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:264)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:81)
at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:264)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:64)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:219)
at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:197)
at org.nutz.dao.impl.NutDao.execute(NutDao.java:967)
at com.nari.nwims.dataloader.biz.resource.service.ConfService.add(ConfService.java:621)
at com.nari.nwims.dataloader.biz.resource.service.ConfService.save(ConfService.java:323)
at com.nari.nwims.dataloader.biz.resource.service.ConfService.saveConf(ConfService.java:134)
at com.nari.nwims.dataloader.biz.resource.ws.ConfSyncImpl.getCIToMonitor(ConfSyncImpl.java:35)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:97)
at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:232)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:69)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:253)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:261)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:662)