Tabnine Logo
DatabaseConnection.rollback
Code IndexAdd Tabnine to your IDE (free)

How to use
rollback
method
in
com.j256.ormlite.support.DatabaseConnection

Best Java code snippets using com.j256.ormlite.support.DatabaseConnection.rollback (Showing top 11 results out of 315)

origin: j256/ormlite-core

@Override
public void rollback(Savepoint savePoint) throws SQLException {
  if (proxy != null) {
    proxy.rollback(savePoint);
  }
}
origin: com.j256.ormlite/ormlite-core

@Override
public void rollback(Savepoint savePoint) throws SQLException {
  if (proxy != null) {
    proxy.rollback(savePoint);
  }
}
origin: j256/ormlite-core

@Override
public void rollBack(DatabaseConnection connection) throws SQLException {
  connection.rollback(null);
}
origin: com.j256.ormlite/ormlite-core

@Override
public void rollBack(DatabaseConnection connection) throws SQLException {
  connection.rollback(null);
}
origin: com.expanset.hk2/hk2-persistence-ormlite

@Override
public void rollback() 
    throws IllegalStateException, SystemException {
  if(status == Status.STATUS_ROLLEDBACK || status == Status.STATUS_COMMITTED) {
    return;
  }            
  
  status = Status.STATUS_ROLLING_BACK;
  try {
    try {
      connection.rollback(savepoint);
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  } finally {
    status = Status.STATUS_ROLLEDBACK;
  }
}
 
origin: j256/ormlite-core

private static void rollBack(DatabaseConnection connection, Savepoint savePoint) throws SQLException {
  String name = (savePoint == null ? null : savePoint.getSavepointName());
  connection.rollback(savePoint);
  if (name == null) {
    logger.trace("rolled back savePoint transaction");
  } else {
    logger.trace("rolled back savePoint transaction {}", name);
  }
}
origin: com.j256.ormlite/ormlite-core

private static void rollBack(DatabaseConnection connection, Savepoint savePoint) throws SQLException {
  String name = (savePoint == null ? null : savePoint.getSavepointName());
  connection.rollback(savePoint);
  if (name == null) {
    logger.trace("rolled back savePoint transaction");
  } else {
    logger.trace("rolled back savePoint transaction {}", name);
  }
}
origin: j256/ormlite-core

@Test
public void testRollback() throws Exception {
  DatabaseConnection conn = createMock(DatabaseConnection.class);
  conn.rollback(null);
  conn.close();
  DatabaseConnectionProxy proxy = new DatabaseConnectionProxy(conn);
  replay(conn);
  proxy.rollback(null);
  proxy.close();
  verify(conn);
}
origin: j256/ormlite-core

@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);
}
origin: j256/ormlite-core

@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);
}
origin: j256/ormlite-core

@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);
}
com.j256.ormlite.supportDatabaseConnectionrollback

Javadoc

Roll back all changes since the savepoint was created. If savePoint is null then roll back all outstanding changes.

Popular methods of DatabaseConnection

  • executeStatement
    Execute a statement directly on the connection.
  • isAutoCommit
    Return if auto-commit is currently enabled.
  • setAutoCommit
    Set the auto-commit to be on (true) or off (false). Setting auto-commit to true may or may-not cause
  • commit
    Commit all changes since the savepoint was created. If savePoint is null then commit all outstanding
  • compileStatement
    Like compileStatement(String, StatementType, FieldType[]) except the caller can specify the result f
  • setSavePoint
    Start a save point with a certain name. It can be a noop if savepoints are not supported.
  • close
  • closeQuietly
    Close the connection to the database but swallow any exceptions.
  • insert
    Perform a SQL update while with the associated SQL statement, arguments, and types. This will possib
  • isAutoCommitSupported
    Return if auto-commit is supported.
  • queryForLong
    Perform a query whose result should be a single long-integer value.
  • delete
    Perform a SQL delete with the associated SQL statement, arguments, and types.
  • queryForLong,
  • delete,
  • isClosed,
  • isTableExists,
  • queryForOne,
  • update,
  • releaseSavePoint

Popular in Java

  • Creating JSON documents from java classes using gson
  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSystemService (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now