org.jpox.resource
Class JdoTransactionHandle

java.lang.Object
  extended by org.jpox.resource.JdoTransactionHandle
All Implemented Interfaces:
javax.jdo.Transaction, javax.resource.cci.LocalTransaction, RDBMSTransaction

public class JdoTransactionHandle
extends java.lang.Object
implements RDBMSTransaction, javax.resource.cci.LocalTransaction

JdoManagedTransaction. Implementations of the methods simply hand off to the transaction of the PM. TODO This is RDBMS-specific now. Why is it here ?

Version:
$Revision: 1.10.2.1 $

Constructor Summary
JdoTransactionHandle(PersistenceManagerImpl pm)
          Constructor
 
Method Summary
 void begin()
          Begin the transaction.
 void commit()
          Commit the transaction.
 java.sql.Connection getConnection(boolean forWriting, boolean forQuery)
          Accessor for the connection to the datasource.
 java.sql.Connection getConnection(boolean forWriting, boolean forQuery, boolean useOpenedConnection)
          Accessor for the connection to the datasource.
 javax.jdo.datastore.JDOConnection getJDOConnection()
           
 boolean getNontransactionalRead()
          Accessor for non-transactional reads
 boolean getNontransactionalWrite()
           
 boolean getOptimistic()
          Accessor for the optimistic transactions flag
 javax.jdo.PersistenceManager getPersistenceManager()
          Accessor for the persistence manager.
 boolean getRestoreValues()
          Accessor for whether to restore values
 boolean getRetainValues()
          Accessor for whether to retain values
 boolean getRollbackOnly()
          Accessor for the "rollback only" flag.
 javax.transaction.Synchronization getSynchronization()
          Accessor for the synchronization
 int getTransactionIsolation()
          Accessor for the transaction isolation level.
 boolean isActive()
          Accessor for whether the transaction is active.
 boolean isCommitting()
          Accessor for whether the transaction is committing.
 boolean isConnectionOpen()
          Checks whether a connection to the datasource is open.
 void releaseConnection(java.sql.Connection conn)
          Method to release the Connection.
 void rollback()
          Perform rollback of the transaction
 void setNontransactionalRead(boolean ntr)
          Mutator for non-transactional reads
 void setNontransactionalWrite(boolean ntw)
          Mutator for non-transactional writes
 void setOptimistic(boolean optimistic)
          set the optimistic transactions flag
 void setRestoreValues(boolean restore_values)
          Mutator for whether to restore values
 void setRetainValues(boolean retain_values)
          Set retainValues flag
 void setRollbackOnly()
          Mutator for the "rollback only" flag.
 void setSynchronization(javax.transaction.Synchronization synch)
          Set the synchronization.
 void setTransactionIsolation(int isolationLevel)
          Mutator for the transaction isolation level.
 void setUseUpdateLock(boolean lock)
          Mutator for whether to lock queried/fetched objects in this txn.
 boolean useUpdateLockOnFetch()
          Accessor for whether to use an update lock when fetching data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdoTransactionHandle

public JdoTransactionHandle(PersistenceManagerImpl pm)
Constructor

Parameters:
pm - the PersistenceManager
Method Detail

begin

public void begin()
Begin the transaction.

Specified by:
begin in interface javax.jdo.Transaction
Specified by:
begin in interface javax.resource.cci.LocalTransaction

commit

public void commit()
Commit the transaction.

Specified by:
commit in interface javax.jdo.Transaction
Specified by:
commit in interface javax.resource.cci.LocalTransaction

rollback

public void rollback()
Perform rollback of the transaction

Specified by:
rollback in interface javax.jdo.Transaction
Specified by:
rollback in interface javax.resource.cci.LocalTransaction

isActive

public boolean isActive()
Accessor for whether the transaction is active.

Specified by:
isActive in interface javax.jdo.Transaction
Returns:
Whether the txn is active

isCommitting

public boolean isCommitting()
Accessor for whether the transaction is committing.

Returns:
Whether the txn is committing

getRollbackOnly

public boolean getRollbackOnly()
Accessor for the "rollback only" flag.

Specified by:
getRollbackOnly in interface javax.jdo.Transaction
Returns:
The rollback only flag

setRollbackOnly

public void setRollbackOnly()
Mutator for the "rollback only" flag.

Specified by:
setRollbackOnly in interface javax.jdo.Transaction

setNontransactionalRead

public void setNontransactionalRead(boolean ntr)
Mutator for non-transactional reads

Specified by:
setNontransactionalRead in interface javax.jdo.Transaction
Parameters:
ntr - Whether to use nontransactional reads

getNontransactionalRead

public boolean getNontransactionalRead()
Accessor for non-transactional reads

Specified by:
getNontransactionalRead in interface javax.jdo.Transaction
Returns:
Whether to use nontransactional reads

setNontransactionalWrite

public void setNontransactionalWrite(boolean ntw)
Mutator for non-transactional writes

Specified by:
setNontransactionalWrite in interface javax.jdo.Transaction
Parameters:
ntw - Whether to use nontransactional writes

getNontransactionalWrite

public boolean getNontransactionalWrite()
Specified by:
getNontransactionalWrite in interface javax.jdo.Transaction
Returns:
Whether to use nontransactional writes

setRetainValues

public void setRetainValues(boolean retain_values)
Set retainValues flag

Specified by:
setRetainValues in interface javax.jdo.Transaction
Parameters:
retain_values -

getRetainValues

public boolean getRetainValues()
Accessor for whether to retain values

Specified by:
getRetainValues in interface javax.jdo.Transaction
Returns:
Whether to retain values

setRestoreValues

public void setRestoreValues(boolean restore_values)
Mutator for whether to restore values

Specified by:
setRestoreValues in interface javax.jdo.Transaction
Parameters:
restore_values - Whether to restore values

getRestoreValues

public boolean getRestoreValues()
Accessor for whether to restore values

Specified by:
getRestoreValues in interface javax.jdo.Transaction
Returns:
Whether to restore values

setOptimistic

public void setOptimistic(boolean optimistic)
set the optimistic transactions flag

Specified by:
setOptimistic in interface javax.jdo.Transaction
Parameters:
optimistic -

getOptimistic

public boolean getOptimistic()
Accessor for the optimistic transactions flag

Specified by:
getOptimistic in interface javax.jdo.Transaction
Returns:

setSynchronization

public void setSynchronization(javax.transaction.Synchronization synch)
Set the synchronization.

Specified by:
setSynchronization in interface javax.jdo.Transaction
Parameters:
synch -

getSynchronization

public javax.transaction.Synchronization getSynchronization()
Accessor for the synchronization

Specified by:
getSynchronization in interface javax.jdo.Transaction
Returns:

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager()
Accessor for the persistence manager.

Specified by:
getPersistenceManager in interface javax.jdo.Transaction
Returns:

getConnection

public java.sql.Connection getConnection(boolean forWriting,
                                         boolean forQuery)
                                  throws java.sql.SQLException
Description copied from interface: RDBMSTransaction
Accessor for the connection to the datasource.

Specified by:
getConnection in interface RDBMSTransaction
Parameters:
forWriting - Whether the connection is read-only or read-write.
forQuery - Whether the connection is to be used by a query (i.e.JDOQUERY).
Returns:
The Connection
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection(boolean forWriting,
                                         boolean forQuery,
                                         boolean useOpenedConnection)
                                  throws java.sql.SQLException
Description copied from interface: RDBMSTransaction
Accessor for the connection to the datasource.

Specified by:
getConnection in interface RDBMSTransaction
Parameters:
forWriting - Whether the connection is read-only or read-write.
forQuery - Whether the connection is to be used by a query (i.e.JDOQUERY).
useOpenedConnection - whether to use an already opened connection, if one is opened.
Returns:
The Connection
Throws:
java.sql.SQLException

isConnectionOpen

public boolean isConnectionOpen()
Description copied from interface: RDBMSTransaction
Checks whether a connection to the datasource is open.

Specified by:
isConnectionOpen in interface RDBMSTransaction
Returns:
true if the Connection is open

releaseConnection

public void releaseConnection(java.sql.Connection conn)
                       throws java.sql.SQLException
Description copied from interface: RDBMSTransaction
Method to release the Connection.

Specified by:
releaseConnection in interface RDBMSTransaction
Parameters:
conn - The Connection to release.
Throws:
java.sql.SQLException - Thrown when an error occurs releasing the connection.

getTransactionIsolation

public int getTransactionIsolation()
Description copied from interface: RDBMSTransaction
Accessor for the transaction isolation level.

Specified by:
getTransactionIsolation in interface RDBMSTransaction
Returns:
The transaction isolation level.

setTransactionIsolation

public void setTransactionIsolation(int isolationLevel)
Description copied from interface: RDBMSTransaction
Mutator for the transaction isolation level.

Specified by:
setTransactionIsolation in interface RDBMSTransaction
Parameters:
isolationLevel - The isolation level required.

useUpdateLockOnFetch

public boolean useUpdateLockOnFetch()
Description copied from interface: RDBMSTransaction
Accessor for whether to use an update lock when fetching data. Will return false if isolation levels of TRANSACTION_REPEATABLE_READ or TRANSACTION_SERIALIZABLE are selected. Otherwise returns the local settings of the useUpdateLock flag.

Specified by:
useUpdateLockOnFetch in interface RDBMSTransaction
Returns:
Whether to use an update lock.

setUseUpdateLock

public void setUseUpdateLock(boolean lock)
Description copied from interface: RDBMSTransaction
Mutator for whether to lock queried/fetched objects in this txn.

Specified by:
setUseUpdateLock in interface RDBMSTransaction
Parameters:
lock - Whether to use an update lock.

getJDOConnection

public javax.jdo.datastore.JDOConnection getJDOConnection()


Copyright © -2008 . All Rights Reserved.