Batch update for spring JdbcTemplate:
1, JdbcTemplate batchUpdate (New string[]{});
Execute multiple SQL statements at a time;
2, Java code final list tmplist = ....; Int count = jdbctemplate.batchupdate (sql, new BatchPreparedStatementSetter () { public int getbatchsize () { return tmplist.size (); } public void setvalues (PreparedStatement ps, int i) throws sqlexception { ps.setstring (1, tmplist .get (i). GetName ( )); Ps.sEtstring (2,tmplist .get (i). GetCode ()); Ps.setstring (3,tmplist .get (i). GetDate ()); Ps.setint (4,tmplist .get (i). GetRank ());  }}) .length;
Final List tmplist = ...;
int count = jdbctemplate.batchupdate (sql, new BatchPreparedStatementSetter () {public
int getbatchsize () {
return Tmplist.size ();
}
public void Setvalues (preparedstatement ps, int i) throws SQLException {
ps.setstring (1, tmplist. Get (i) getName ());
ps.setstring (2,tmplist. Get (i). GetCode ());
Ps.setstring (3,tmplist. Get (i). GetDate ());
Ps.setint (4,tmplist. Get (i). GetRank ());
Length
This method can be batch, but in spring it is executed in one piece, and a large amount of data execution is inefficient
3, write preparedstatement for batch Java code final list<tmpbean> tmpbeanlist=...; final string sql = ....; int[] count = (int[]) this.pushjdbctemplate.execute (sql, new PreparedStatementCallback () { public object doinpreparedstatement (PREPAREDSTATEMENT&NBSP;PS) throws SQLException, dataaccessexception { int length = stockranlist.size (); Ps.getconnection (). Setautocommit (false); for (int i=0;i<length;i++) { &Nbsp; ps.setstring (1, Tmpbeanlist.get (i). GetName ()); ps.setstring (2,tmpbeanlist.get (i). GetCode ()); ps.setstring (3,tmpbeanlist.get (i). GetDate ()); ps.setint (4,tmpbeanlist.get (i). GetRank ()); ps.addbatch (); } object o = ps.executebatch (); Ps.getconnection (). commit (); Ps.getconnection (). Setautocommit (True); //If you use <aop:config> to control the transaction, you need to note the previous line, or you will be the error return o;  }});