错误代码:WLTC0032W ibatis作为持久层,websphere 报告连接没有提交错误,问题的解决以及产生的原因

As I said, iBATIS is trying to avoid extra commits when they are not
needed.  So iBATIS sets auto commit to false, and then will commit the
transaction if an insert, update, or delete has been performed.  This works
in many environments, but not WebSphere.

This is precisely why there are options on the transaction managers -
because all the different environments work a little differently.

I added some information about this in the developer guide a few weeks ago.

Jeff Butler


On 7/7/06, Cornel Antohi <cantohi@kepler-rominfo.com> wrote:
>
>  Hi Jeff,
>
> In order to avoid extra commits, shouldn't iBatis do:
>
> connection.setAutoCommit(*true*); ?
>
> But iBatis always make connection.setAutoCommit(*false*) which means that
> we have to perform a connection.commit() at the end ... I do not
> understand why iBatis is ALWAYS making:
> connection.setAutoCommit(false);
>
> What is the reason?
>
> Thank you,
>  Cornel
>
> ----- Original Message -----
> *From:* Jeff Butler <jeffgbutler@gmail.com>
> *To:* user-java@ibatis.apache.org
> *Sent:* Friday, July 07, 2006 3:09 PM
> *Subject:* Re: autoCommit
>
>
> iBATIS is trying to avoid extra commits when they are not needed, but that
> doesn't play well with WebSphere.  This is a "feature" of WebSphere.  See
> here:
>
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Environment+Specific+Information
>
> Other transaction managers are a little looser in their implementations.
>
> In other words - that's just the way it is.
>
> Jeff Butler
>
>
> On 7/7/06, Cornel Antohi <cantohi@kepler-rominfo.com> wrote:
> >
> >  Hi,
> >
> > I have found in com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction
> > class, init method, the following lines of code:
> >
> > // AutoCommit
> > *if* (connection .getAutoCommit()) {
> >     connection.setAutoCommit(*false* ); }
> >
> > I do not understand why should it be set to "false" by default, even I
> > am running simple SELECT statements !
> >
> > Using Websphere as application server, I am receiving the following
> > warning messages after each database call:
> > [7/7/06 13:40:41:111 EEST] 00000026 LocalTranCoor W   WLTC0032W: One or
> > more local transaction resources were rolled back during the cleanup of a
> > LocalTransactionContainment.
> >
> > and sometimes errors like Websphere cannot cleanup the connection
> > because it seems to be in a transaction !!!
> >
> > One solution found on Internet is to setup in sql-map-config:
> > <
> > transactionManager type="JDBC" *commitRequired="true" *>
> > and iBatis will perform a commit() at the end (see SqlMapConfigParser
> > and TransactionManager classes):
> >
> > txManager.setForceCommit(
> > "true".equals(attributes.getProperty( "commitRequired"))); ...
> > if
> > (session.isCommitRequired() || forceCommit ) {     trans.commit();
> >     session.setCommitRequired(
> > *false*); }
> >
> > My question is: why should I use "commitRequired=true" even if I am
> > executing a simple SELECT statement ? I feel that this "commitRequired=true"
> > is a workaround to a problem generated by wrong initialization of the
> > JdbcTransaction!
> >
> > Thank you,
> > Cornel
> >
>
>
 最有用的一句话的意思是:在ibatis 的sql-map-config.xml中配置好下面这句话,强制提交:
 <transactionManager type="JDBC"  commitRequired="true" >
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值