fr.paris.lutece.util.sql
Class Transaction

java.lang.Object
  extended by fr.paris.lutece.util.sql.Transaction

public class Transaction
extends java.lang.Object

Transaction


Field Summary
static int COMMITED
           
static int OPENED
           
static int ROLLEDBACK
           
 
Constructor Summary
Transaction()
          Constructor
Transaction(Plugin plugin)
          Constructor
 
Method Summary
 void commit()
          Commit the transaction
 void executeStatement()
          Execute the current statement
protected  void finalize()
          Checks that the transaction has been commited (or rolled back) before being destroyed and release all transaction resources (statement, connection, ...) if not.
 java.sql.PreparedStatement getStatement()
          The current prepared statement
 int getStatus()
          Return the transaction status
 void prepareStatement(java.lang.String strSQL)
          Gets a prepared statement
 void rollback()
          Rollback the transaction
 void rollback(java.lang.Exception e)
          Rollback the transaction
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPENED

public static final int OPENED
See Also:
Constant Field Values

COMMITED

public static final int COMMITED
See Also:
Constant Field Values

ROLLEDBACK

public static final int ROLLEDBACK
See Also:
Constant Field Values
Constructor Detail

Transaction

public Transaction()
Constructor


Transaction

public Transaction(Plugin plugin)
Constructor

Parameters:
plugin - The plugin ownner of the transaction
Method Detail

prepareStatement

public void prepareStatement(java.lang.String strSQL)
                      throws java.sql.SQLException
Gets a prepared statement

Parameters:
strSQL - The SQL statement
Throws:
java.sql.SQLException - If an SQL error occurs

getStatement

public java.sql.PreparedStatement getStatement()
The current prepared statement

Returns:
The current statement

executeStatement

public void executeStatement()
                      throws java.sql.SQLException
Execute the current statement

Throws:
java.sql.SQLException - If an SQL error occurs

commit

public void commit()
Commit the transaction


rollback

public void rollback()
Rollback the transaction


rollback

public void rollback(java.lang.Exception e)
Rollback the transaction

Parameters:
e - The exception that cause the rollback

getStatus

public int getStatus()
Return the transaction status

Returns:
The transaction status

finalize

protected void finalize()
                 throws java.lang.Throwable
Checks that the transaction has been commited (or rolled back) before being destroyed and release all transaction resources (statement, connection, ...) if not.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 2011 Mairie de Paris. All Rights Reserved.