de.mathema.pride
Class PreparedOperation

java.lang.Object
  extended by de.mathema.pride.PreparedOperation
All Implemented Interfaces:
TransactionListener
Direct Known Subclasses:
PreparedInsert, PreparedUpdate

public abstract class PreparedOperation
extends java.lang.Object
implements TransactionListener

Abstract base class for convenient usage of prepared statements. Support for that is pretty new in PriDE and not yet completed. Currently there are the derived classes PreparedUpdate and PreparedInsert available for the most important kinds of operations which require performance optimization.

Author:
Jan Lessner

Field Summary
protected  Database db
           
protected  java.lang.String operation
           
protected  RecordDescriptor red
           
static java.lang.String REVISION_ID
           
protected  java.sql.PreparedStatement stmt
           
 
Constructor Summary
PreparedOperation(java.lang.String operation, RecordDescriptor red)
           
 
Method Summary
 void addBatch(java.lang.Object obj)
           
 void close()
           
 void commit(TransactionEvent e)
          Function to be called on successful completion of a transaction.
 int execute(java.lang.Object obj)
           
 int[] executeBatch()
           
 void rollback(TransactionEvent e)
          Function to be called on transaction abortion The listeners' rollback functions are called before the actual rollback is performed.
abstract  void setParameters(java.lang.Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stmt

protected java.sql.PreparedStatement stmt

red

protected RecordDescriptor red

operation

protected java.lang.String operation

db

protected Database db

REVISION_ID

public static final java.lang.String REVISION_ID
See Also:
Constant Field Values
Constructor Detail

PreparedOperation

public PreparedOperation(java.lang.String operation,
                         RecordDescriptor red)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

execute

public int execute(java.lang.Object obj)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

addBatch

public void addBatch(java.lang.Object obj)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

setParameters

public abstract void setParameters(java.lang.Object obj)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Throws:
java.sql.SQLException

commit

public void commit(TransactionEvent e)
            throws java.sql.SQLException
Description copied from interface: TransactionListener
Function to be called on successful completion of a transaction. The listeners' commit functions are called before the actual commitment is performed. If any listener throws an Exception the commitment will be ommited.

Specified by:
commit in interface TransactionListener
Throws:
java.sql.SQLException

rollback

public void rollback(TransactionEvent e)
              throws java.sql.SQLException
Description copied from interface: TransactionListener
Function to be called on transaction abortion The listeners' rollback functions are called before the actual rollback is performed. If any listener throws an Exception the rollback will be ommited.

Specified by:
rollback in interface TransactionListener
Throws:
java.sql.SQLException