com.subshell.persistence.transaction
Class TransactionContext

java.lang.Object
  extended by com.subshell.persistence.transaction.TransactionContext

public class TransactionContext
extends Object

Provides a thread-local transaction context.


Constructor Summary
TransactionContext(Transaction transaction)
          Creates a new transaction context.
 
Method Summary
<T> void
addPersistenceMapper(Class<T> clazz, PersistenceMapper<T> mapper)
           
static void clearCurrentContext()
          Clears the transaction context to be associated with the current thread.
static TransactionContext getCurrentContext()
          Returns the transaction context associated with the current thread.
<T> PersistenceMapper<T>
getPersistenceMapper(Class<T> clazz)
           
 Transaction getTransaction()
          Returns this transaction context's transaction.
static void setCurrentContext(TransactionContext context)
          Sets the transaction context to be associated with the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionContext

public TransactionContext(Transaction transaction)
Creates a new transaction context.

Parameters:
transaction - transaction this transaction context is storing
Method Detail

getCurrentContext

public static TransactionContext getCurrentContext()
Returns the transaction context associated with the current thread.

Returns:
transaction context
Throws:
TransactionContextNotSetException - when there is no transaction context associated with the current thread

setCurrentContext

public static void setCurrentContext(TransactionContext context)
Sets the transaction context to be associated with the current thread.


clearCurrentContext

public static void clearCurrentContext()
Clears the transaction context to be associated with the current thread.


getTransaction

public Transaction getTransaction()
Returns this transaction context's transaction.


getPersistenceMapper

public <T> PersistenceMapper<T> getPersistenceMapper(Class<T> clazz)

addPersistenceMapper

public <T> void addPersistenceMapper(Class<T> clazz,
                                     PersistenceMapper<T> mapper)


Copyright © 2004-2005 subshell GmbH. All Rights Reserved.