ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaur <jason.laurice...@pepsi.com>
Subject Re: Help with what "commitRequired=true" param means
Date Tue, 10 Jun 2008 14:37:08 GMT

I have attached code from our application that shows the problem transaction. 
The business delegate code calls the sql map data access/dao code.

The transaction is an insert and so the reason why I am confused why it does
not commit unless I specify and set the aforementioned param to true.

I want to be sure that providing the param is indeed necessary and that I am
not just patching something that perhaps in a deeper issue pertaining to the
oracle 10g upgrade.

I don't know if this helps, but, I have a basic single table insert that is
executed by ibatis (no transaction involved) and that commits to the db with
no problems.

Thanks greatly. 

Nicholoz Koka Kiknadze wrote:
> Here's extract from iBatis docs:
> *Normally iBATIS will not commit transactions unless an insert, update, or
> delete operation has been
> performed. This is true even if you explicitly call the
> commitTransaction()
> method. This behavior
> creates problems in some cases. If you want iBATIS to always commit
> transactions, even if no insert,
> update, or delete operation has been performed, then set the value of the
> commitRequired attribute to true.
> Examples of where this attribute is useful include:
>     1.   If you call a stored procedures that updates data as well as
> returning rows. In that case you would
>          call the procedure with the queryForList() operation – so iBATIS
> would not normally commit the
>          transaction. But then the updates would be rolled back.
>     2.   In a WebSphere environment when you are using connection pooling
> and you use the JNDI
>          <dataSource> and the JDBC or JTA transaction manager. WebSphere
> requires all transactions on
>          pooled connections to be committed or the connection will not be
> returned to the pool.
> Note that the commitRequired attribute has no effect when using the
> transaction manager.
> *
> So it does not explain why your transactions are not commited with
> commitRequired=false if you do call commitTransactio() after
> insert/update/delete (and I think you do not care about commiting after
> selects).
> Could you provide sample transaction code from your app which you suspect
> does not commit ?
> On Tue, Jun 10, 2008 at 5:26 PM, jlaur <jason.lauricella@pepsi.com> wrote:
>> Hi,
>> We are using Ibatis vs 2.2.0, and are going thru the process of updating
>> our db to Oracle 10g.  We are noticing behavior (after the upgrade) in
>> our test env where our ibatis transactions do not commit.  Through some
>> research on the internet, we discovered that we were not providing the
>> "commitRequired=true" param to the transaction manager config found in
>> the sql-map-config.xml file.  When we did provide this param setting,
>> the transactions handled by ibatis would then commit.
>> <transactionManager type="JDBC" commitRequired="true" >
>> <!--Oracle DataSource  -->
>> <dataSource type="JNDI" >
>> <property name="DataSource" value="${urlOracle}"/>
>> <property name="Driver.SetBigStringTryClob" value="true" />
>> </dataSource>
>> </transactionManager>
>> My question is :
>> What exactly does this param signify, and were we correct in its
>> application for the problem described above ?
>> Thanks greatly for your help,
>> Regards,
>> Jason.
>> --
>> View this message in context:
>> http://www.nabble.com/Help-with-what-%22commitRequired%3Dtrue%22-param-means-tp17755411p17755411.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
http://www.nabble.com/file/p17757007/code.txt code.txt 
View this message in context: http://www.nabble.com/Help-with-what-%22commitRequired%3Dtrue%22-param-means-tp17755411p17757007.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message