Ok. Will the following code guarantee 100% that there won't be any id gaps
when H2 is server (there are other clients)?
Connection conn= getting connection from pool
conn.setAutoCommit(false);
ps =
conn.prepareStatement(query,Statement.RETURN_GENERATED_KEYS);
for (Answer answer:list) {
ps.setInt(1, answer.getTaskId());
ps.setString(2, answer.getText());
ps.setInt(3, answer.getOrder());
if (answer.getGroupKey()!=null){
ps.setString(4,answer.getGroupKey());
}else{
ps.setNull(4, java.sql.Types.VARCHAR);
}
ps.setInt(5, answer.getScore());
ps.addBatch();
}
int[]temp=ps.executeBatch();
conn.commit();
conn.setAutoCommit(true);
conn.close();
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.