当前位置: 首页>>代码示例>>Java>>正文


Java SqlMapClient.endTransaction方法代码示例

本文整理汇总了Java中com.ibatis.sqlmap.client.SqlMapClient.endTransaction方法的典型用法代码示例。如果您正苦于以下问题:Java SqlMapClient.endTransaction方法的具体用法?Java SqlMapClient.endTransaction怎么用?Java SqlMapClient.endTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibatis.sqlmap.client.SqlMapClient的用法示例。


在下文中一共展示了SqlMapClient.endTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: commit

import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类
public void commit(IBatisEndpoint endpoint, Exchange exchange, Object data, String consumeStatements) throws Exception {
    SqlMapClient client = endpoint.getSqlMapClient();
    boolean useTrans = endpoint.isUseTransactions();
    String[] statements = consumeStatements.split(",");
    try {
        if (useTrans) {
            client.startTransaction(isolation);
        }
        for (String statement : statements) {
            client.update(statement.trim(), data);
        }
        if (useTrans) {
            client.commitTransaction();
        }
    } finally {
        if (useTrans) {
            client.endTransaction();
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:DefaultIBatisProcessingStategy.java

示例2: transactionsShouldBeTraced

import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类
@Ignore // Changed to trace only query operations
@Test
public void transactionsShouldBeTraced() throws Exception {
    // Given
    SqlMapClient sqlMapClient = new SqlMapClientImpl(this.mockSqlMapExecutorDelegate);
    // When
    sqlMapClient.startTransaction();
    sqlMapClient.commitTransaction();
    sqlMapClient.endTransaction();
    // Then
    final List<SpanEventBo> spanEvents = getCurrentSpanEvents();
    assertThat(spanEvents.size(), is(3));

    // Check Method
    final SpanEventBo startTransactionSpanEventBo = spanEvents.get(0);
    final SpanEventBo commitTransactionSpanEventBo = spanEvents.get(1);
    final SpanEventBo endTransactionSpanEventBo = spanEvents.get(2);

    assertThat(startTransactionSpanEventBo.getApiId(), not(0));
    assertThat(commitTransactionSpanEventBo.getApiId(), not(0));
    assertThat(endTransactionSpanEventBo.getApiId(), not(0));

    assertThat(startTransactionSpanEventBo.getApiId(), not(commitTransactionSpanEventBo.getApiId()));
    assertThat(commitTransactionSpanEventBo.getApiId(), not(endTransactionSpanEventBo.getApiId()));
    assertThat(endTransactionSpanEventBo.getApiId(), not(startTransactionSpanEventBo.getApiId()));

    // Check Parameter
    assertNull(startTransactionSpanEventBo.getAnnotationBoList());
    assertNull(commitTransactionSpanEventBo.getAnnotationBoList());
    assertNull(endTransactionSpanEventBo.getAnnotationBoList());
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:32,代码来源:SqlMapClientImplModifierTest.java


注:本文中的com.ibatis.sqlmap.client.SqlMapClient.endTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。