ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Goodin" <brandon.goo...@gmail.com>
Subject Re: autoCommit=false, but still commits?
Date Mon, 27 Aug 2007 19:47:31 GMT
What Datasource are you using?

Brandon

On 8/27/07, Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2 <
jonathan.leffingwell.ctr@navy.mil> wrote:
>
>  I'm using IBM RAD 6.0, iBatis 2.0.3 (we're not authorized to move to
> anything beyond that), and the DBMS is Oracle 10g.  I'm having problems that
> I've never had before with Oracle 9i, and I wonder if there is a solution
> someone can help me with.
>
> In a nutshell, I have a method called processITS that calls a different
> method (insertITS), and the insertITS method performs a number of SELECT,
> INSERT, UPDATE, and DELETE calls, depending on the values of certain
> variables.  It looks kinda like this:
>
> processITS (List laborList)
> {
>   try{
>   // Bunch of stuff here.
>   transactionManager.startTransaction();
>   itsLaborMgr.insertITSLabor(itsLaborList);
>
>   //Loop through itsLaborList to see if any errors were found.
>   If (noErrors)
>   {
>     transactionManager.commitTransaction();
>   }
>   } catch Exception {
>      //Exception stuff here.
>   } finally {
>     transactionManager.endTransaction();
>   }
> }
>
> insertITS (itsLaborList)
> {
>   Iterator iterator = itsLaborList.iterator();
>   while(iterator.hasNext())
>   {
>      //Business rule checks. If errors found, then get out of WHILE loop.
>      If (errors)
>      {
>         //Add errors to itsLaborList to return to processITS. Get out of
> this method.
>      }
>      else
>      {
>         //No errors, so do a bunch of SELECT/INSERT/UPDATE/DELETE calls.
>      }
>   }//END-while
> }
>
> As you can see, I only have the COMMIT in one place, and that's in the
> processITS method.  When I set up my debug stop, I see that the COMMIT never
> gets called when there are errors coming back from insertITS (which is
> correct).  YET when I look in the database, the COMMIT happened anyway.
>
> I've searched here, and I thought this might do the trick:
>
> [Contents of sql-map-config.xml]
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE sqlMapConfig
>                         PUBLIC "-//ibatis.apache.org//DTD SQL Map Config
> 2.0//EN"
>                 "***http://ibatis.apache.org/dtd/sql-map-config-2.dtd*<http://ibatis.apache.org/dtd/sql-map-config-2.dtd>
> ">
>
> <sqlMapConfig>
>
>   <!--
>         This was removed and code added to the BaseTaaManager Constructor
>         to read this properties file and pass the properties into the
>         daoManagerBuilder to populate the parameters
>
>         <properties resource="blahblahblah/config/database.properties"/>
>
>         The above is no longer required - configure in server.xml
>   -->
>
>   <settings
>     cacheModelsEnabled="false"
>     enhancementEnabled="false"
>         lazyLoadingEnabled="false"
>     maxSessions="64"
>     maxTransactions="32"
>     maxRequests="512"/>
>   <transactionManager type="JDBC" commitRequired="true">
>         <property name="DefaultAutoCommit" value="false"/>
>         <property name="SetAutoCommitAllowed" value="false"/>
>     <dataSource type="${type}">
>                 <property value="${datasource}" name="DataSource"/>
>                 <property value="${driver}" name="JDBC.Driver"/>
>             <property value="${url}" name="JDBC.ConnectionURL"/>
>                 <property value="${username}" name="JDBC.Username"/>
>                 <property value="${password}" name="JDBC.Password"/>
>     </dataSource>
>   </transactionManager>
>
>   <sqlMap resource="blahblahblah/sql/taaSQL.xml"/>
> </sqlMapConfig>
>
> [End of sql-map-config.xml]
>
> Specifically, I thought adding DefaultAutoCommit and SetAutoCommitAllowed would
> work, but upon redeployment, I see that nothing's different, i.e. the
> COMMIT is still happening.  In other words, an AutoCommit is happening
> somewhere (since there is no other COMMIT, and COMMIT is never being called
> within the code), but I don't know where.  HELP!
>
> Jonathan
>

Mime
View raw message