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


Java DatabaseConnection.rollback方法代码示例

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


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

示例1: rollBack

import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
private static void rollBack(DatabaseConnection paramDatabaseConnection, Savepoint paramSavepoint)
{
  String str;
  if (paramSavepoint == null)
    str = null;
  else
    str = paramSavepoint.getSavepointName();
  paramDatabaseConnection.rollback(paramSavepoint);
  if (str == null)
  {
    logger.debug("rolled back savePoint transaction");
    return;
  }
  logger.debug("rolled back savePoint transaction {}", str);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:16,代码来源:TransactionManager.java

示例2: rollBack

import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
private static void rollBack(DatabaseConnection connection, Savepoint savePoint) throws SQLException {
	String name = (savePoint == null ? null : savePoint.getSavepointName());
	connection.rollback(savePoint);
	if (name == null) {
		logger.debug("rolled back savePoint transaction");
	} else {
		logger.debug("rolled back savePoint transaction {}", name);
	}
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:10,代码来源:TransactionManager.java

示例3: testTransactionManagerRollback

import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
@Test
public void testTransactionManagerRollback() throws Exception {
	ConnectionSource connectionSource = createMock(ConnectionSource.class);
	DatabaseConnection conn = createMock(DatabaseConnection.class);
	expect(conn.isAutoCommitSupported()).andReturn(false);
	Savepoint savePoint = createMock(Savepoint.class);
	expect(savePoint.getSavepointName()).andReturn("name").anyTimes();
	expect(conn.setSavePoint(isA(String.class))).andReturn(savePoint);
	conn.rollback(savePoint);
	expect(connectionSource.getDatabaseType()).andReturn(databaseType);
	expect(connectionSource.getReadWriteConnection(null)).andReturn(conn);
	expect(connectionSource.saveSpecialConnection(conn)).andReturn(true);
	connectionSource.clearSpecialConnection(conn);
	connectionSource.releaseConnection(conn);
	replay(connectionSource, conn, savePoint);
	TransactionManager tm = new TransactionManager(connectionSource);
	try {
		tm.callInTransaction(new Callable<Void>() {
			@Override
			public Void call() throws Exception {
				throw new SQLException("you better roll back!!");
			}
		});
		fail("expected an exception");
	} catch (SQLException e) {
		// expected
	}
	verify(connectionSource, conn, savePoint);
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:30,代码来源:TransactionManagerTest.java

示例4: testTransactionManagerRollbackNullSavePoint

import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
@Test
public void testTransactionManagerRollbackNullSavePoint() throws Exception {
	ConnectionSource connectionSource = createMock(ConnectionSource.class);
	DatabaseConnection conn = createMock(DatabaseConnection.class);
	expect(conn.isAutoCommitSupported()).andReturn(false);
	expect(conn.setSavePoint(isA(String.class))).andReturn(null);
	conn.rollback(null);
	expect(connectionSource.getDatabaseType()).andReturn(databaseType);
	expect(connectionSource.getReadWriteConnection(null)).andReturn(conn);
	expect(connectionSource.saveSpecialConnection(conn)).andReturn(true);
	connectionSource.clearSpecialConnection(conn);
	connectionSource.releaseConnection(conn);
	replay(connectionSource, conn);
	TransactionManager tm = new TransactionManager(connectionSource);
	try {
		tm.callInTransaction(new Callable<Void>() {
			@Override
			public Void call() throws Exception {
				throw new SQLException("you better roll back!!");
			}
		});
		fail("expected an exception");
	} catch (SQLException e) {
		// expected
	}
	verify(connectionSource, conn);
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:28,代码来源:TransactionManagerTest.java

示例5: testTransactionManagerRollbackOtherException

import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
@Test
public void testTransactionManagerRollbackOtherException() throws Exception {
	ConnectionSource connectionSource = createMock(ConnectionSource.class);
	DatabaseConnection conn = createMock(DatabaseConnection.class);
	expect(conn.isAutoCommitSupported()).andReturn(false);
	Savepoint savePoint = createMock(Savepoint.class);
	expect(savePoint.getSavepointName()).andReturn("name").anyTimes();
	expect(conn.setSavePoint(isA(String.class))).andReturn(savePoint);
	conn.rollback(savePoint);
	expect(connectionSource.getDatabaseType()).andReturn(databaseType);
	expect(connectionSource.getReadWriteConnection(null)).andReturn(conn);
	expect(connectionSource.saveSpecialConnection(conn)).andReturn(true);
	connectionSource.clearSpecialConnection(conn);
	connectionSource.releaseConnection(conn);
	replay(connectionSource, conn, savePoint);
	TransactionManager tm = new TransactionManager(connectionSource);
	try {
		tm.callInTransaction(new Callable<Void>() {
			@Override
			public Void call() throws Exception {
				throw new Exception("you better roll back!!");
			}
		});
		fail("expected an exception");
	} catch (Exception e) {
		// expected
	}
	verify(connectionSource, conn, savePoint);
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:30,代码来源:TransactionManagerTest.java

示例6: rollBack

import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
public void rollBack(DatabaseConnection paramDatabaseConnection)
{
  paramDatabaseConnection.rollback(null);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:BaseDaoImpl.java

示例7: rollBack

import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
@Override
public void rollBack(DatabaseConnection connection) throws SQLException {
	connection.rollback(null);
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:5,代码来源:BaseDaoImpl.java


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