Im using JDBC, with autocommit=true. In one of the operation, I'm doing a batch inserts, using prepared statements.
public void executeBatchInsert(String query, List<Object[]> entityList) {
try {
pstmt = conn.prepareStatement(query);
for(int i=0; i<entityList.size(); i++) {
int j=1;
for(Object o: entityList.get(i)) {
pstmt.setObject(j++, formatColumnValue(o));
}
pstmt.addBatch();
if((i+1)%1000 == 0) {
pstmt.executeBatch();
}
}
pstmt.executeBatch();
} catch (SQLException e) {
}
}
If I get an exception while executing it, when I close this connection, will all the locks be released and the rollback happens?
-- B. Teja.