首页 > 代码库 > Manual transaction control in Expression/Synchcronize Robot

Manual transaction control in Expression/Synchcronize Robot

1. Expression robot中没有自动transaction控制,即如有需要,请手工添加;

  Test Scenario: 在expression中添加了update两笔part attribute的code如下

1 part1 = (WTPart) CustAttributeOperationUtil.setAttributeValue(part1, "customerParts", "SBB03");2 PersistenceServerHelper.manager.update(part1);3 4 part1 = (WTPart) CustAttributeOperationUtil.setAttributeValue(part2, "customerParts", "SBB03"); 5 PersistenceServerHelper.manager.update(part2);6 throw new WTException("testWFExprRobotTransaction");

   结果:当异常发生时,part的customerParts已update生效。

2. Synchcronize Robot中有自动transaction控制,即不需要手工添加,而且在synchcronize完成之前如有异常发生,数据会自动rollback,如有加了,会报如下的exception:

    wt.pom.PersistenceException: The commit is mismatched. It corresponds to level "1". Current level is "0"

 

Manual transaction control in Expression/Synchcronize Robot