1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
try {
jt.batchUpdate(
"insert into b_chat_history (id,from_phone,from_user,to_phone,to_user,type,msg,url,thumb,length,timestamp) value (?,?,?,?,?,?,?,?,?,?,?)" ,
new BatchPreparedStatementSetter() {
public void setValues(PreparedStatement ps, int i) throws SQLException {
ps.setString( 1 , UUID.randomUUID().toString()); // ID的值
ps.setString( 2 , list.get(i).getFrom_phone());
ps.setString( 3 , list.get(i).getFrom_user());
ps.setString( 4 , list.get(i).getTo_phone());
ps.setString( 5 , list.get(i).getTo_user());
ps.setString( 6 , list.get(i).getType());
ps.setString( 7 , list.get(i).getMsg());
ps.setString( 8 , list.get(i).getUrl());
ps.setString( 9 , list.get(i).getThumb());
ps.setInt( 10 ,list.get(i).getLength());
ps.setTimestamp( 11 , list.get(i).getTimestamp());
}
public int getBatchSize() {
return list.size();
}
});
} catch (Exception e2) {
System.out.println( "可能有数据异常,同步部分数据异常" );
e2.printStackTrace();
}
|
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责,本站只提供参考并不构成任何投资及应用建议。本站是一个个人学习交流的平台,网站上部分文章为转载,并不用于任何商业目的,我们已经尽可能的对作者和来源进行了通告,但是能力有限或疏忽,造成漏登,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。