java.sql

Interface Savepoint

public interface Savepoint

The representation of a savepoint, which is a point within the current transaction that can be referenced from the Connection.rollback method. When a transaction is rolled back to a savepoint all changes made after that savepoint are undone.

Savepoints can be either named or unnamed. Unnamed savepoints are identified by an ID generated by the underlying data source.

Since:
1.4

Method Summary

int
getSavepointId()
Retrieves the generated ID for the savepoint that this Savepoint object represents.
String
getSavepointName()
Retrieves the name of the savepoint that this Savepoint object represents.

Method Details

getSavepointId

public int getSavepointId()
            throws SQLException
Retrieves the generated ID for the savepoint that this Savepoint object represents.
Returns:
the numeric ID of this savepoint
Throws:
SQLException - if this is a named savepoint
Since:
1.4
Usages and Demos :

View More Examples of getSavepointId()
   1:             connection.setSavepoint();
   2:             assertTrue("Setting savepoint should not work in auto-commit mode", false);
   3:         } catch(SQLException e) {
   4:         ...
   5:                 
   6:             Savepoint svpt1 = connection.setSavepoint();
   7:             
   8:         ...
   9:                 
  10:             Savepoint svpt1 = connection.setSavepoint("test");
  11:             
  12:         ...
  13:             try {
  14:                 svpt1.getSavepointId();

View Full Code Here

getSavepointName

public String getSavepointName()
            throws SQLException
Retrieves the name of the savepoint that this Savepoint object represents.
Returns:
the name of this savepoint
Throws:
SQLException - if this is an un-named savepoint
Since:
1.4
Usages and Demos :

View More Examples of getSavepointName()
   1:             connection.setSavepoint();
   2:             assertTrue("Setting savepoint should not work in auto-commit mode", false);
   3:         } catch(SQLException e) {
   4:         ...
   5:                 
   6:             Savepoint svpt1 = connection.setSavepoint();
   7:             
   8:         ...
   9:             try {
  10:                 svpt1.getSavepointName();
  11:             } catch(SQLException ex) {
  12:         ...
  13:                 
  14:             Savepoint svpt1 = connection.setSavepoint("test");

View Full Code Here