tag:blogger.com,1999:blog-6527688743456205256.post6385621342836407347..comments2024-03-29T22:58:35.913+11:00Comments on The Blas from Pas: Batch Inserting using Spring JDBC (JdbcTemplate)Pas Apicellahttp://www.blogger.com/profile/09389663166398991762noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6527688743456205256.post-72694572444993694382012-08-30T14:08:49.448+10:002012-08-30T14:08:49.448+10:00Hi,
2 things you would do for that
1. Change thi...Hi,<br /><br />2 things you would do for that<br /><br />1. Change this line of code, assuming the first column was a sequence nextval request<br /><br />public final String INSERT_SQL = "insert into jdbc_batch_table values (:1, :2, :3)"<br /><br />to<br /><br />public final String INSERT_SQL = "insert into jdbc_batch_table values (myseq.nextval, :1, :2)"<br /><br />2. Then fix the code to only pass 2 parameters as follows<br /><br /> public void setValues(PreparedStatement ps, int i) throws SQLException <br /> { <br /> ps.setString(1, jdbcBatchEntries.get(i).getMessageType()); <br /> ps.setString(2, jdbcBatchEntries.get(i).getMessage()); <br /> } Pas Apicellahttps://www.blogger.com/profile/09389663166398991762noreply@blogger.comtag:blogger.com,1999:blog-6527688743456205256.post-83486426971738466852012-08-29T16:27:35.485+10:002012-08-29T16:27:35.485+10:00Hi,Can you please explain how to use sequence in ...Hi,Can you please explain how to use sequence in that case..If datasbe table have already sequence then how we mention it with spring jdbcTemplate while inserting the recards..Noman Sadiqhttps://www.blogger.com/profile/18210042419201464901noreply@blogger.com