MyBatis autocommit sequence questions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

MyBatis autocommit sequence questions

Jon C

I would like to understand how autocommit settings "stick" when they are set in MyBatis Java code.

In my mybatis-config.xml
   <environments default="any">
      <environment id="any">
        <transactionManager type="JDBC"/>
        <dataSource type="POOLED">
          <property name="defaultAutoCommit" value="true"/>  <!--Put here intentionally, so we know how we start -->

The java code flows in this (pseudo-code) sequence:
        openSession();   -1
some sql-1  // These are discrete sql statements and should be committed individually since autocommit=true
some sql-n
//Now we get to part of functionality where multiple sql statements should be treated as a  transaction
        openSession(false);  -2      // Code should commit or rollback
some sql-1a
some sql-1n
         commit or rollback
//Now we get to functionality where each sql is an individual transaction
         openSession();   -3 

After openSession() -3, is the state autocommit=true or autocommit-false?

I could write code to try it myself, but your help would be buying me time, big time! So thanks.


You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit