org.agileclick.genorm.runtime
Class GenOrmGroupedConnection

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

public class GenOrmGroupedConnection
extends java.lang.Object
implements GenOrmConnection

This behaves similar to GenOrmTransactionConnection except a connection is not held open. All records that have been modified are flushed using separate connections when commit is called on this object.


Constructor Summary
GenOrmGroupedConnection(GenOrmDSEnvelope dse)
           
 
Method Summary
 boolean addToTransaction(GenOrmRecord goi)
          Returns true if the record was added to a transaction returns false if there is no transaction
 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 setProperty(java.lang.String name, java.lang.Object value)
          Sets a property to be associated with this connection
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenOrmGroupedConnection

public GenOrmGroupedConnection(GenOrmDSEnvelope dse)
Method Detail

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

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