mybatis oracle6,mybatis+ojdbc6.jar的一个奇怪问题记录

使用以下代码、配置时,发生异常。

代码:public interface IRowPropSubInfoMapper {

/**

* 将数据写入行基础信息子表中

*

* @author 團長

* @since 2013-12-19

* @param row

* 行基础信息。

* @return 插入的行数

* @throws SQLException

* 数据库操作发生异常时将抛出此异常。

* @deprecated 2013-12-19 改用批量操作

*/

@Deprecated

public int insertRowPropSubInfo(IRowPropSubInfoModel row)

throws SQLException;

}

mybatis的配置:

sql语句配置(sql语句中配置的参数个数,即values中的参数个数,小于等于7个时则可以正常执行;大于7个时将抛出异常。异常信息见后续。)

parameterType="com.sinosig.evaluation.fcff.model.dto.IRowPropSubInfoModel">

insert into

t_eva_fcff_row_property values

(#{fcffid,jdbcType=INTEGER},

#{code,jdbcType=VARCHAR},

#{name,jdbcType=VARCHAR},

#{description,jdbcType=VARCHAR},

#{isshow,jdbcType=VARCHAR},

#{currentPremethodCode, jdbcType=VARCHAR},

#{currentPreValue, jdbcType=VARCHAR},

#{currentScaleBase, jdbcType=VARCHAR},

#{warningDescription, jdbcType=VARCHAR})

spring类配置:

parent="BaseMybatisDao">

value="com.sinosig.evaluation.fcff.dao.IRowPropSubInfoMapper" />

数据源配置:

destroy-method="close">

测试代码:@Test

public void testInsert() {

List rowList = initRowList();

try {

int count = 1;

for (IRowPropSubInfoModel iRowSubInfoModel : rowList) {

System.out.println(count++);

System.out.println("fcffid = " + iRowSubInfoModel.getFcffid());

System.out.println("code = " + iRowSubInfoModel.getCode());

System.out.println("name = " + iRowSubInfoModel.getName());

System.out.println("description = "

+ iRowSubInfoModel.getDescription());

System.out.println("isshow = " + iRowSubInfoModel.getIsshow());

System.out.println("currentPremethodCode = "

+ iRowSubInfoModel.getCurrentPremethodCode());

System.out.println("currentPreValue = "

+ iRowSubInfoModel.getCurrentPreValue());

System.out.println("currentScaleBase = "

+ iRowSubInfoModel.getCurrentScaleBase());

System.out.println("warningDescription = "

+ iRowSubInfoModel.getWarningDescription());

mapper.insertRowPropSubInfo(iRowSubInfoModel);

}

} catch (SQLException e) {

e.printStackTrace();

fail();

}

}

异常信息:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error preparing statement. Cause: java.lang.ArrayIndexOutOfBoundsException: 9

at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)

at $Proxy5.insert(Unknown Source)

at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:236)

at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:79)

at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40)

at $Proxy31.insertRowPropSubInfo(Unknown Source)

at test.com.sinosig.evaluation.fcff.dao.RowPropSubInfoMapperTest.testInsert(RowPropSubInfoMapperTest.java:69)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

at org.junit.runners.BlockJUnit4Cla***unner.runNotIgnored(BlockJUnit4Cla***unner.java:79)

at org.junit.runners.BlockJUnit4Cla***unner.runChild(BlockJUnit4Cla***unner.java:71)

at org.junit.runners.BlockJUnit4Cla***unner.runChild(BlockJUnit4Cla***unner.java:49)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Caused by: org.apache.ibatis.executor.ExecutorException: Error preparing statement. Cause: java.lang.ArrayIndexOutOfBoundsException: 9

at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:91)

at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:54)

at org.apache.ibatis.executor.ReuseExecutor.prepareStatement(ReuseExecutor.java:73)

at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:46)

at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:108)

at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)

at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:145)

at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)

... 29 more

Caused by: java.lang.ArrayIndexOutOfBoundsException: 9

at oracle.jdbc.driver.OracleSql.computeBasicInfo(OracleSql.java:950)

at oracle.jdbc.driver.OracleSql.getSqlKind(OracleSql.java:623)

at oracle.jdbc.driver.OraclePreparedStatement.(OraclePreparedStatement.java:1212)

at oracle.jdbc.driver.T4CPreparedStatement.(T4CPreparedStatement.java:28)

at oracle.jdbc.driver.T4CDriverExtension.allocatePreparedStatement(T4CDriverExtension.java:68)

at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3140)

at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3042)

at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:5890)

at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:508)

at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:400)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:53)

at $Proxy32.prepareStatement(Unknown Source)

at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:65)

at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:82)

... 41 more

改用ojdbc14-10.2.0.1.0.jar则不会出现上述问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值