Java Code Examples for org.apache.ibatis.transaction.Transaction#commit()

The following examples show how to use org.apache.ibatis.transaction.Transaction#commit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ManagedTransactionFactoryTest.java    From mybaties with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnections() throws Exception {
  TransactionFactory tf = new ManagedTransactionFactory();
  tf.setProperties(new Properties());
  Transaction tx = tf.newTransaction(conn);
  assertEquals(conn, tx.getConnection());
  tx.commit();
  tx.rollback();
  tx.close();
  verify(conn).close();
}
 
Example 2
Source File: ManagedTransactionFactoryTest.java    From mybaties with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnectionsAndDoesNotCloseConnection() throws Exception {
  TransactionFactory tf = new ManagedTransactionFactory();
  Properties props = new Properties();
  props.setProperty("closeConnection", "false");
  tf.setProperties(props);
  Transaction tx = tf.newTransaction(conn);
  assertEquals(conn, tx.getConnection());
  tx.commit();
  tx.rollback();
  tx.close();
  verifyNoMoreInteractions(conn);
}
 
Example 3
Source File: ManagedTransactionFactoryTest.java    From mybatis with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnections() throws Exception {
  TransactionFactory tf = new ManagedTransactionFactory();
  tf.setProperties(new Properties());
  Transaction tx = tf.newTransaction(conn);
  assertEquals(conn, tx.getConnection());
  tx.commit();
  tx.rollback();
  tx.close();
  verify(conn).close();
}
 
Example 4
Source File: ManagedTransactionFactoryTest.java    From mybatis with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldEnsureThatCallsToManagedTransactionAPIDoNotForwardToManagedConnectionsAndDoesNotCloseConnection() throws Exception {
  TransactionFactory tf = new ManagedTransactionFactory();
  Properties props = new Properties();
  props.setProperty("closeConnection", "false");
  tf.setProperties(props);
  Transaction tx = tf.newTransaction(conn);
  assertEquals(conn, tx.getConnection());
  tx.commit();
  tx.rollback();
  tx.close();
  verifyNoMoreInteractions(conn);
}