其他分享
首页 > 其他分享> > mybatis BaseMapper int insert(T entity) 方法异常

mybatis BaseMapper int insert(T entity) 方法异常

作者:互联网

//该方法报错,猜测的jdbc jar包有bug,属性超过8个会报数组溢出异常,因为是使用属性下标取值,不是根据属性名称取值
// 使用ojdbc6 11.2.0.2.0,估计jar包有问题
// 解决办法:改用xml写sql语句,指定jdbcType,防止属性为空时不能识别类型报错
int insert(T entity);

Caused by: java.lang.ArrayIndexOutOfBoundsException: 13
at oracle.jdbc.driver.OracleSql.computeBasicInfo(OracleSql.java:950) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.OracleSql.getSqlKind(OracleSql.java:623) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:1212) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.T4CPreparedStatement.<init>(T4CPreparedStatement.java:28) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.T4CDriverExtension.allocatePreparedStatement(T4CDriverExtension.java:68) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3140) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3042) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:6022) ~[ojdbc6-11.2.0.1.0.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:685) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:343) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:681) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:962) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:176) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:681) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:366) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:485) ~[druid-1.1.10.jar:1.1.10]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_251]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_251]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_251]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_251]
at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:55) ~[mybatis-3.5.0.jar:3.5.0]
at com.sun.proxy.$Proxy235.prepareStatement(Unknown Source) ~[na:na]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:83) ~[mybatis-3.5.0.jar:3.5.0]
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88) ~[mybatis-3.5.0.jar:3.5.0]
... 98 common frames omitted

标签:insert,java,1.1,10,int,BaseMapper,jar,druid,prepareStatement
来源: https://www.cnblogs.com/shihx/p/13091422.html