pl.kernelpanic.dbmonster.connection
Class Transaction

java.lang.Object
  extended bypl.kernelpanic.dbmonster.connection.Transaction

public class Transaction
extends Object

This class provides an unified interface for JDBC connections. It wraps standard JDBC calls.

Version:
$Id: Transaction.html,v 1.1 2007/06/21 08:38:14 sbahloul Exp $
Author:
Piotr Maj <piotr.maj@kernelpanic.pl>

Constructor Summary
Transaction(ConnectionProvider cp)
          Constructs a new connection provider.
 
Method Summary
 void abort()
          Aborts the connection.
 Connection begin()
          Starts the JDBC transaction.
 void close()
          Closes the connection.
 void commit()
          Commits the transaction.
 void execute()
          Executes a prepared statement.
 ResultSet executeQuery(String query)
          Executes query.
 PreparedStatement prepareStatement(String query)
          Prepares statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transaction

public Transaction(ConnectionProvider cp)
Constructs a new connection provider.

Parameters:
cp - a connection provider
Method Detail

begin

public final Connection begin()
                       throws SQLException
Starts the JDBC transaction.

Returns:
a connection
Throws:
SQLException - if connection cannot be established

commit

public final void commit()
                  throws SQLException
Commits the transaction.

Throws:
SQLException - if connection cannot be established

abort

public final void abort()
Aborts the connection.


close

public final void close()
Closes the connection.


executeQuery

public final ResultSet executeQuery(String query)
                             throws SQLException
Executes query.

Parameters:
query - the query string
Returns:
result set
Throws:
SQLException - if somethig goes wrong

prepareStatement

public final PreparedStatement prepareStatement(String query)
                                         throws SQLException
Prepares statement.

Parameters:
query - the query
Returns:
a statement
Throws:
SQLException - if query cannot be prepared

execute

public final void execute()
                   throws SQLException
Executes a prepared statement. Used only for updates.

Throws:
SQLException - if query could not be executed.


Copyright © 2003-2005 .:. kernelpanic.pl .:.. All Rights Reserved.