我尝试使用批处理将数据库插入Oracle数据库。如果列数小于50,一切正常并且插入有效。但是如果列数为50或更多,我会收到错误(java.lang.ArrayIndexOutOfBoundsException)。
完整堆栈跟踪如下所示:
********************************************************************************
Message : 50 (java.lang.ArrayIndexOutOfBoundsException).
Payload : <payload>
Payload Type : java.util.LinkedHashMap
Element : /batch-genresourceBatch/process-records/0/0 @ batch-genresource:batch-genresource.xml:29
Element XML : <db:insert config-ref="Oracle_Configuration" doc:name="Database">
<db:parameterized-query><insert query></db:insert>
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.ArrayIndexOutOfBoundsException: 50
at oracle.jdbc.driver.OracleParameterMetaDataParser.computeBasicInfo(OracleParameterMetaDataParser.java:260)
at oracle.jdbc.driver.OracleParameterMetaDataParser.getParameterMetaDataSql(OracleParameterMetaDataParser.java:432)
at oracle.jdbc.driver.OracleParameterMetaData.getParameterMetaData(OracleParameterMetaData.java:58)
at oracle.jdbc.driver.OraclePreparedStatement.getParameterMetaData(OraclePreparedStatement.java:11621)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.getParameterMetaData(OraclePreparedStatementWrapper.java:1552)
at org.mule.module.db.internal.resolver.param.QueryParamTypeResolver.getParameterTypes(QueryParamTypeResolver.java:45)
at org.mule.module.db.internal.resolver.param.DefaultParamTypeResolver.getParamTypesUsingMetadata(DefaultParamTypeResolver.java:74)
at org.mule.module.db.internal.resolver.param.DefaultParamTypeResolver.getParameterTypes(DefaultParamTypeResolver.java:49)
at org.mule.module.db.internal.domain.connection.AbstractDbConnection.getParamTypes(AbstractDbConnection.java:53)
at org.mule.module.db.internal.resolver.query.ParametrizedQueryResolver.getParameterTypes(ParametrizedQueryResolver.java:68)
at org.mule.module.db.internal.resolver.query.ParametrizedQueryResolver.resolve(ParametrizedQueryResolver.java:56)
at org.mule.module.db.internal.processor.AbstractSingleQueryDbMessageProcessor.executeQuery(AbstractSingleQueryDbMessageProcessor.java:48)
at org.mule.module.db.internal.processor.AbstractDbMessageProcessor.process(AbstractDbMessageProcessor.java:81)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:88)
at org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:59)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at com.mulesoft.module.batch.engine.BatchProcessingTemplate.process(BatchProcessingTemplate.java:91)
at com.mulesoft.module.batch.DefaultBatchStep.processRecord(DefaultBatchStep.java:360)
at com.mulesoft.module.batch.DefaultBatchStep.onRecord(DefaultBatchStep.java:273)
at com.mulesoft.module.batch.engine.threading.BatchRecordWork.run(BatchRecordWork.java:90)
at org.mule.work.WorkerContext.run(WorkerContext.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
在上面的日志&lt; 有效负载&gt;中,&lt; 插入查询&gt;是我从原始有效负载和插入查询替换的占位符。 因为它是客户数据,所以我无法共享这些字段。但插入查询看起来像这样:
INSERT INTO Table123(col1,col,.....upto 50)VALUES(#[message.payload.'col1'],#[message.payload.'col2'],...upto #[message.payload.'col50'])