org.agileclick.genorm.runtime
Class GenOrmTransactionConnection

java.lang.Object
  extended by org.agileclick.genorm.runtime.GenOrmTransactionConnection
All Implemented Interfaces:
GenOrmConnection

public class GenOrmTransactionConnection
extends java.lang.Object
implements GenOrmConnection


Constructor Summary
GenOrmTransactionConnection(GenOrmDSEnvelope dse)
           
GenOrmTransactionConnection(GenOrmDSEnvelope dse, java.sql.Connection con)
           
 
Method Summary
 boolean addToTransaction(GenOrmRecord goi)
          Returns true if the record was added to a transaction returns false if there is no transaction
 void begin()
           
 void close()
           
 void commit()
           
 java.sql.Statement createStatement()
          The connection will be closed when the statement is closed
 void flush()
          Flush all modified records that are part of the current transaction
 GenOrmRecord getCachedRecord(GenOrmRecordKey key)
          Returns the cached record if it exists, null otherwise
 java.sql.Connection getConnection()
           
 GenOrmKeyGenerator getKeyGenerator(java.lang.String table)
           
 java.lang.Object getProperty(java.lang.String name)
          Gets a property set on this connection
 GenOrmRecord getUniqueRecord(GenOrmRecord rec)
          Returns a unique record instance for this transaction.
 boolean isCommitted()
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
          The connection will be closed when the statement is closed
 void rollback()
           
 void setConnection(java.sql.Connection con)
           
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a property to be associated with this connection
 GenOrmTransactionConnection setTransaction(boolean transaction)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenOrmTransactionConnection

public GenOrmTransactionConnection(GenOrmDSEnvelope dse)

GenOrmTransactionConnection

public GenOrmTransactionConnection(GenOrmDSEnvelope dse,
                                   java.sql.Connection con)
Method Detail

setTransaction

public GenOrmTransactionConnection setTransaction(boolean transaction)

begin

public void begin()

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Sets a property to be associated with this connection

Specified by:
setProperty in interface GenOrmConnection

getProperty

public java.lang.Object getProperty(java.lang.String name)
Gets a property set on this connection

Specified by:
getProperty in interface GenOrmConnection

getUniqueRecord

public GenOrmRecord getUniqueRecord(GenOrmRecord rec)
Returns a unique record instance for this transaction. If the record is in the cache it returns the cached record otherwise the record is added to the cache and returned

Specified by:
getUniqueRecord in interface GenOrmConnection

getCachedRecord

public GenOrmRecord getCachedRecord(GenOrmRecordKey key)
Returns the cached record if it exists, null otherwise

Specified by:
getCachedRecord in interface GenOrmConnection

flush

public void flush()
Flush all modified records that are part of the current transaction

Specified by:
flush in interface GenOrmConnection

commit

public void commit()
Specified by:
commit in interface GenOrmConnection

isCommitted

public boolean isCommitted()
Specified by:
isCommitted in interface GenOrmConnection

close

public void close()
Specified by:
close in interface GenOrmConnection

rollback

public void rollback()
Specified by:
rollback in interface GenOrmConnection

setConnection

public void setConnection(java.sql.Connection con)

getConnection

public java.sql.Connection getConnection()
Specified by:
getConnection in interface GenOrmConnection

getKeyGenerator

public GenOrmKeyGenerator getKeyGenerator(java.lang.String table)
Specified by:
getKeyGenerator in interface GenOrmConnection

addToTransaction

public boolean addToTransaction(GenOrmRecord goi)
Description copied from interface: GenOrmConnection
Returns true if the record was added to a transaction returns false if there is no transaction

Specified by:
addToTransaction in interface GenOrmConnection

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
The connection will be closed when the statement is closed

Specified by:
createStatement in interface GenOrmConnection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
The connection will be closed when the statement is closed

Specified by:
prepareStatement in interface GenOrmConnection
Throws:
java.sql.SQLException