mybatis插入數據庫時的問題記錄

mybatis接口調用以下java

rowPropSubInfoMapper.insertRowPropSubInfo(iRowPropSubInfoModel);


使用的mapper配置以下spring

<insert id="insertRowPropSubInfo"
        parameterType="com.sinosig.evaluation.fcff.model.dto.IRowPropSubInfoModel">
        insert into
        t_eva_fcff_row_property
        (FCFFID,
        ROWCODE,
        ROWNAME,
        ROWDESCRIPTION,
        ISSHOW,
        CURRENTPREMETHOD,
        CURRENTPREVALUE,
        CURRENTSCALEBASE,
        WARNINGDESCRIPTION)
        values
        (#{fcffid},
        #{code},
        #{name},
        #{description},
        #{isshow},
        #{currentPremethodCode},
        #{currentPreValue},
        #{currentScaleBase},
        #{warningDescription})
    </insert>


拋出的異常信息以下:
sql

[DEBUG]2013-12-17 17:26:54,166 java.sql.Connection#debug()@47: ==>  Preparing: insert into t_eva_fcff_row_property (FCFFID, ROWCODE, ROWNAME, ROWDESCRIPTION, ISSHOW, CURRENTPREMETHOD, CURRENTPREVALUE, CURRENTSCALEBASE, WARNINGDESCRIPTION) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
[DEBUG]2013-12-17 17:26:54,166 org.mybatis.spring.SqlSessionUtils#debug()@47: Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2a851f]
[DEBUG]2013-12-17 17:26:54,166 org.springframework.jdbc.datasource.DataSourceUtils#doReleaseConnection()@327: Returning JDBC Connection to DataSource
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 $Proxy32.insertRowPropSubInfo(Unknown Source)
    at com.sinosig.evaluation.fcff.service.manage.impl.RowPropSubInfoTempSaveImpl.visitRowPropSubInfo(RowPropSubInfoTempSaveImpl.java:111)
    at com.sinosig.evaluation.fcff.model.impl.FcffModelImpl.acceptVisitor(FcffModelImpl.java:1203)
    at com.sinosig.evaluation.fcff.service.manage.impl.RowPropSubInfoTempSaveImpl.updateSubInfo(RowPropSubInfoTempSaveImpl.java:77)
    at com.sinosig.evaluation.fcff.service.manage.AbstractSaveSubInfoService.call(AbstractSaveSubInfoService.java:95)
    at test.com.sinosig.evaluation.fcff.service.RowSubInfoSaveImplTest.testUpdateSubInfo(RowSubInfoSaveImplTest.java:43)
    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)
    ... 33 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.<init>(OraclePreparedStatement.java:1212)
    at oracle.jdbc.driver.T4CPreparedStatement.<init>(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 $Proxy33.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)
    ... 45 more


尤爲奇怪的是,若是在insert語句中,將插入的列減小到7列或如下,則可以正常執行;8列或以上就會拋出這個異常,而且java.lang.ArrayIndexOutOfBoundsException: 9最後的數字就是列數。apache


折磨了我整整三天了。若是算上之前的問題,至少折磨了我一個禮拜了。頭大。
session

相關文章
相關標籤/搜索