如何在Websphere AS 7.0上查找事务中执行的sql语句



我有一个Websphere Application Server 7.0.0.9,上面运行的应用程序使用springframework 2.0.9hibernate 3.3.0(或者3.4.0,或者两者都使用,我不确定)。TransactionManager是org.springframework.transaction.jta.WebSphereUowTransactionManager

我有一个注释为@org.springframework.transaction.annotation.Transactional的方法。此方法调用另一个方法,该方法也被注释为@org.springframework.transaction.annotation.Transactional:

@Transactional
public void myMethod() {
    doSomeUpdates();
    nestedMethod();
}
@Transactional
public void nestedMethod() {
    doSomeMoreUpdates();
}

方法"myMethod"应该是原子的。有时,当"doSomeUpdates"的更新被回滚,但"doSome MoreUpdates"中的更新被提交时会出现错误。

默认传播设置为Propagation.REQUIRED。我尝试将代码更改为:

@Transactional
public void myMethod() {
    doSomeUpdates();
    nestedMethod();
}
@Transactional(propagation = Propagation.MANDATORY)
public void nestedMethod() {
    doSomeMoreUpdates();
}

我试着在日志中查找这个更改是否解决了我的错误,但无法让我的日志文件陷入困境。我通过org.hibernate.jdbc.util.SQLStatementLogger类记录sql语句,并使用以下设置将事务琐事转储到websphere的trace.log文件中:

com.ibm.wsspi.uow.*=finest: com.ibm.ws.uow.*=finest:
com.ibm.ws.jtaextensions.*=finest: org.hibernate.transaction.*=finest:
org.springframework.transaction.*=finest: com.ibm.ws.Transaction.*=finest:
com.ibm.ws.LocalTransaction.*=finest: com.ibm.ws.tx.*=finest:
oracle.jdbc.*=finest:

这会产生的无用数据,但sql语句仅由SQLStatementLogger转储,看起来与websphere事务无关。如何查看websphere在每个事务中真正执行了哪些sql语句?

我们上周刚刚遇到这个问题。看起来专门的插件类WebSphereUowTransactionManager在Spring中进行了更改,以适应Websphere 7.x

我们使用Spring framework 3.0.5版本来安装WebSphere 6.1。然而,当我们迁移到WebSphere7.1时,我们遇到了与您上面提到的问题类似的问题。我们疯狂地试图找出这个问题,直到我们将Spring框架升级到3.1.1版本。现在一切又顺利了。

祝你好运。

最新更新