本文整理汇总了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();
}
}
}
示例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());
}