org.datanucleus.jdo
Class JDOTransaction

java.lang.Object
  extended by org.datanucleus.jdo.JDOTransaction
All Implemented Interfaces:
javax.jdo.Transaction

public class JDOTransaction
extends java.lang.Object
implements javax.jdo.Transaction

Wrapper for the transaction for use by JDO.


Constructor Summary
JDOTransaction(JDOPersistenceManager pm, Transaction tx)
          Constructor
 
Method Summary
protected  void assertNotCommitting()
          Throw an Exception if the underlying transaction is currently committing.
protected  void assertNotInUse()
          Asserts that the transaction is not in use.
 void begin()
          Method to start the transaction.
 void commit()
          Method to commit the transaction.
 java.lang.String getIsolationLevel()
          Accessor for the current isolation level.
 boolean getNontransactionalRead()
          Accessor for nontransactionalRead setting
 boolean getNontransactionalWrite()
          Accessor for nontransactionalWrite setting
 boolean getOptimistic()
          Accessor for optimistic setting
 JDOPersistenceManager getPersistenceManager()
          Accessor for the JDO PersistenceManager
 boolean getRestoreValues()
          Accessor for restoreValues setting
 boolean getRetainValues()
          Accessor for retainValues setting
 boolean getRollbackOnly()
          Accessor for whether to allow rollback only
 java.lang.Boolean getSerializeRead()
          Accessor for whether to serialise any read objects in this transaction.
 javax.transaction.Synchronization getSynchronization()
          Accessor for the synchronization (if any)
protected  void internalBegin()
          Called by PMF under required synchronization
 boolean isActive()
          Accessor for whether the transaction is active
 void rollback()
          Method to rollback the transaction
 void setIsolationLevel(java.lang.String level)
          Mutator for the isolation level.
 void setNontransactionalRead(boolean flag)
          Mutator for the nontransactionalRead setting
 void setNontransactionalWrite(boolean flag)
          Mutator for the nontransactionalWrite setting
 void setOptimistic(boolean opt)
          Mutator for the optimistic setting
 void setOption(java.lang.String option, boolean value)
          Convenience accessor for setting a transaction option.
 void setOption(java.lang.String option, int value)
          Convenience accessor for setting a transaction option.
 void setOption(java.lang.String option, java.lang.String value)
          Convenience accessor for setting a transaction option.
 void setRestoreValues(boolean restore)
          Mutator for the restore values setting
 void setRetainValues(boolean retain)
          Mutator for the retain values setting
 void setRollbackOnly()
          Mutator for the rollback-only setting
 void setSerializeRead(java.lang.Boolean serialize)
          Mutator for whether to serialise any read objects.
 void setSynchronization(javax.transaction.Synchronization synch)
          Mutator for the Synchronisation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDOTransaction

public JDOTransaction(JDOPersistenceManager pm,
                      Transaction tx)
Constructor

Parameters:
pm - The JDO PersistenceManager
tx - The real transaction
Method Detail

isActive

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

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

begin

public void begin()
Method to start the transaction.

Specified by:
begin in interface javax.jdo.Transaction

internalBegin

protected void internalBegin()
Called by PMF under required synchronization


commit

public void commit()
Method to commit the transaction.

Specified by:
commit in interface javax.jdo.Transaction

rollback

public void rollback()
Method to rollback the transaction

Specified by:
rollback in interface javax.jdo.Transaction

getNontransactionalRead

public boolean getNontransactionalRead()
Accessor for nontransactionalRead setting

Specified by:
getNontransactionalRead in interface javax.jdo.Transaction
Returns:
The setting for nontransactionalRead

getNontransactionalWrite

public boolean getNontransactionalWrite()
Accessor for nontransactionalWrite setting

Specified by:
getNontransactionalWrite in interface javax.jdo.Transaction
Returns:
The setting for nontransactionalWrite

getOptimistic

public boolean getOptimistic()
Accessor for optimistic setting

Specified by:
getOptimistic in interface javax.jdo.Transaction
Returns:
The setting for optimistic

getPersistenceManager

public JDOPersistenceManager getPersistenceManager()
Accessor for the JDO PersistenceManager

Specified by:
getPersistenceManager in interface javax.jdo.Transaction
Returns:
The JDO PM

getRestoreValues

public boolean getRestoreValues()
Accessor for restoreValues setting

Specified by:
getRestoreValues in interface javax.jdo.Transaction
Returns:
The setting for restoreValues

getRetainValues

public boolean getRetainValues()
Accessor for retainValues setting

Specified by:
getRetainValues in interface javax.jdo.Transaction
Returns:
The setting for retainValues

getRollbackOnly

public boolean getRollbackOnly()
Accessor for whether to allow rollback only

Specified by:
getRollbackOnly in interface javax.jdo.Transaction
Returns:
Whether to allow rollback only

getSynchronization

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

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

setNontransactionalRead

public void setNontransactionalRead(boolean flag)
Mutator for the nontransactionalRead setting

Specified by:
setNontransactionalRead in interface javax.jdo.Transaction
Parameters:
flag - Whether to allow nontransactional read

setNontransactionalWrite

public void setNontransactionalWrite(boolean flag)
Mutator for the nontransactionalWrite setting

Specified by:
setNontransactionalWrite in interface javax.jdo.Transaction
Parameters:
flag - Whether to allow nontransactional write

setOptimistic

public void setOptimistic(boolean opt)
Mutator for the optimistic setting

Specified by:
setOptimistic in interface javax.jdo.Transaction
Parameters:
opt - Whether to use optimistic transactions

setRestoreValues

public void setRestoreValues(boolean restore)
Mutator for the restore values setting

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

setRetainValues

public void setRetainValues(boolean retain)
Mutator for the retain values setting

Specified by:
setRetainValues in interface javax.jdo.Transaction
Parameters:
retain - Whether to retain values after commit

setRollbackOnly

public void setRollbackOnly()
Mutator for the rollback-only setting

Specified by:
setRollbackOnly in interface javax.jdo.Transaction

setSynchronization

public void setSynchronization(javax.transaction.Synchronization synch)
Mutator for the Synchronisation

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

setIsolationLevel

public void setIsolationLevel(java.lang.String level)
Mutator for the isolation level.

Specified by:
setIsolationLevel in interface javax.jdo.Transaction
Parameters:
level - The level
Throws:
javax.jdo.JDOUserException - if the required level is not supported.

getIsolationLevel

public java.lang.String getIsolationLevel()
Accessor for the current isolation level.

Specified by:
getIsolationLevel in interface javax.jdo.Transaction
Returns:
The isolation level.

assertNotCommitting

protected void assertNotCommitting()
Throw an Exception if the underlying transaction is currently committing.


assertNotInUse

protected void assertNotInUse()
Asserts that the transaction is not in use.


getSerializeRead

public java.lang.Boolean getSerializeRead()
Accessor for whether to serialise any read objects in this transaction.

Specified by:
getSerializeRead in interface javax.jdo.Transaction
Returns:
The setting for whether to serialise any read objects

setSerializeRead

public void setSerializeRead(java.lang.Boolean serialize)
Mutator for whether to serialise any read objects.

Specified by:
setSerializeRead in interface javax.jdo.Transaction
Parameters:
serialize - Whether to serialise any read objects in this transaction

setOption

public void setOption(java.lang.String option,
                      int value)
Convenience accessor for setting a transaction option.

Parameters:
option - option name
value - The value

setOption

public void setOption(java.lang.String option,
                      boolean value)
Convenience accessor for setting a transaction option.

Parameters:
option - option name
value - The value

setOption

public void setOption(java.lang.String option,
                      java.lang.String value)
Convenience accessor for setting a transaction option.

Parameters:
option - option name
value - The value


Copyright © 2011. All Rights Reserved.