本文整理汇总了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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例6: rollBack
import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
public void rollBack(DatabaseConnection paramDatabaseConnection)
{
paramDatabaseConnection.rollback(null);
}
示例7: rollBack
import com.j256.ormlite.support.DatabaseConnection; //导入方法依赖的package包/类
@Override
public void rollBack(DatabaseConnection connection) throws SQLException {
connection.rollback(null);
}