ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From I L <iss...@hotmail.com>
Subject Using Connection.commit() in place of SqlMapSession.commitTransaction(). "commitRequired" Benefit
Date Wed, 08 Apr 2009 01:19:31 GMT

Hi guys,

This is a two part question.

1) Is there a significant performance pickup if you use commitRequired="false". As you know
this attribute is set to false by default. I couldn't find any information on the benefit
of keeping that field false.

2) I would like to run an sql update query using a Statement object. Its for throw away install
scripts that I do not want the sql to be in the xml files.

So if I run an sql update query using a Statement object with commitRequired="false", the
expected behavior of sqlMapSession.commitTransaction() would be to do nothing because ibatis
didn't detect the update. So what I ended up doing is the following code snippet:


  Connection connection = sqlMapSession.getCurrentConnection();
  Statement stmt = connection.createStatement()

  stmt.executeUpdate("UPDATE item SET type="NA");
  connection.commit(); //did not use sqlMapSession.commitTransaction()

Note how I used the connection's commit() instead of commitTransaction(). Is this ok? Am I
bypassing something that could be dangerous? From my testing, it shows that everything is

Thank you in advance.


Rediscover HotmailĀ®: Get quick friend updates right in your inbox. 
View raw message