druid 数据源,插入数据只能成功一条,第二次(第二条)没法插入成功 50
使用的是mybatis,spring和druidmapper配置<insertid="insert"parameterType="Dept">INSERTINTOXT_D...
使用的是mybatis,spring和druid
mapper配置
<insert id="insert" parameterType="Dept">
INSERT INTO XT_DEPT(<include refid="columns"/>)
VALUES (#{id,jdbcType=VARCHAR},#{deptName,jdbcType=VARCHAR},#{address,jdbcType=VARCHAR},
#{leader,jdbcType=VARCHAR},#{tel,jdbcType=VARCHAR},#{distCode,jdbcType=VARCHAR},
#{postCode,jdbcType=VARCHAR},#{fax,jdbcType=VARCHAR},#{pid,jdbcType=VARCHAR})
</insert>
测试代码
@Test
public void testServiceInsert(){
for(int i = 1000; i < 10020;i++){
Dept d = new Dept();
d.setId(UUIDUtil.getID());
d.setDeptName("第"+i+"次数据");
d.setDistCode("360124");
d.setAddress("啊沙发撒旦法"+i);
d.setTel("010-2342234");
d.setFax("010-342342");
d.setPid(null);
d.setPostCode("330821");
d.setLeader("米子"+i);
int rs = service.insert(d);
System.out.println(rs);
}
}
第一条成功的
第二条时:java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
### The error may involve com.hdsx.framework.author.mapper.orcl.DeptMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO XT_DEPT( ID, DEPTNAME, ADDRESS, LEADER, TEL, DISTCODE, POSTCODE, FAX, PID ) VALUES (?,?,?, ?,?,?, ?,?,?)
### Cause: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
; uncategorized SQLException for SQL []; SQL state [null]; error code [17041]; 索引中丢失 IN 或 OUT 参数:: 10; nested exception is java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
----------------------
Caused by: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1742)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3334)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3445)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
.......
第一条数据在数据库中看到了,可以肯定成功了 展开
mapper配置
<insert id="insert" parameterType="Dept">
INSERT INTO XT_DEPT(<include refid="columns"/>)
VALUES (#{id,jdbcType=VARCHAR},#{deptName,jdbcType=VARCHAR},#{address,jdbcType=VARCHAR},
#{leader,jdbcType=VARCHAR},#{tel,jdbcType=VARCHAR},#{distCode,jdbcType=VARCHAR},
#{postCode,jdbcType=VARCHAR},#{fax,jdbcType=VARCHAR},#{pid,jdbcType=VARCHAR})
</insert>
测试代码
@Test
public void testServiceInsert(){
for(int i = 1000; i < 10020;i++){
Dept d = new Dept();
d.setId(UUIDUtil.getID());
d.setDeptName("第"+i+"次数据");
d.setDistCode("360124");
d.setAddress("啊沙发撒旦法"+i);
d.setTel("010-2342234");
d.setFax("010-342342");
d.setPid(null);
d.setPostCode("330821");
d.setLeader("米子"+i);
int rs = service.insert(d);
System.out.println(rs);
}
}
第一条成功的
第二条时:java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
### The error may involve com.hdsx.framework.author.mapper.orcl.DeptMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO XT_DEPT( ID, DEPTNAME, ADDRESS, LEADER, TEL, DISTCODE, POSTCODE, FAX, PID ) VALUES (?,?,?, ?,?,?, ?,?,?)
### Cause: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
; uncategorized SQLException for SQL []; SQL state [null]; error code [17041]; 索引中丢失 IN 或 OUT 参数:: 10; nested exception is java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
----------------------
Caused by: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 10
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1742)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3334)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3445)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
.......
第一条数据在数据库中看到了,可以肯定成功了 展开
2个回答
展开全部
UITableView 有一个方法,叫做
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
indexPaths是一个数组,里面装的是NSIndexPath,就是指插入的位置,animation是BOOL值,是否要动画效果。
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
indexPaths是一个数组,里面装的是NSIndexPath,就是指插入的位置,animation是BOOL值,是否要动画效果。
追问
看不太懂,好像不是java是安卓代码吧。框架的数据源要使用druid,这个不能变的(bonecp的以前就可以使用了)。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询