Package org.silverpeas.core.persistence
Class Transaction
- java.lang.Object
-
- org.silverpeas.core.persistence.Transaction
-
-
Constructor Summary
Constructors Constructor Description Transaction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getStatus()
Gets the current status of this transaction.static Transaction
getTransaction()
Gets a transaction instance in order to perform some transactional tasks.static int
getTransactionStatus()
Gets the status of the transaction currently in the current thread.protected boolean
isActive()
static boolean
isTransactionActive()
Is there a transaction currently active in the current thread?<V> V
perform(Process<V> process)
The given process is executed in a transaction: support a current transaction, create a new one if none exists.static <V> V
performInNew(Process<V> process)
Performs in a new transaction the specified process.static <V> V
performInOne(Process<V> process)
Performs in a single transaction the specified process.<V> V
performNew(Process<V> process)
The given process is executed in a new transaction, even it is called from an existent one.
-
-
-
Method Detail
-
getTransaction
public static Transaction getTransaction()
Gets a transaction instance in order to perform some transactional tasks.- Returns:
- a transaction.
-
performInOne
public static <V> V performInOne(Process<V> process)
Performs in a single transaction the specified process.- Type Parameters:
V
- the type of the return value.- Parameters:
process
- the process to execute in a transaction.- Returns:
- the result of the process.
-
performInNew
public static <V> V performInNew(Process<V> process)
Performs in a new transaction the specified process.- Type Parameters:
V
- the type of the return value.- Parameters:
process
- the process to execute in a transaction.- Returns:
- the result of the process.
-
isTransactionActive
public static boolean isTransactionActive()
Is there a transaction currently active in the current thread?- Returns:
- true if there is a transaction active in the current thread, false otherwise.
-
getTransactionStatus
public static int getTransactionStatus()
Gets the status of the transaction currently in the current thread. If there is no transaction, thenStatus.STATUS_NO_TRANSACTION
is returned.- Returns:
- the current transaction's status.
- See Also:
Status
-
perform
public <V> V perform(Process<V> process)
The given process is executed in a transaction: support a current transaction, create a new one if none exists. Analogous to EJB transaction attribute of the same name.- Type Parameters:
V
- the type of the return value.- Parameters:
process
- the process to execute in a transaction.- Returns:
- the result of the process.
-
getStatus
public int getStatus()
Gets the current status of this transaction.- Returns:
- the status code of this transaction.
- See Also:
Status
-
performNew
public <V> V performNew(Process<V> process)
The given process is executed in a new transaction, even it is called from an existent one. Analogous to EJB transaction attribute of the same name.- Type Parameters:
V
- the type of the return value.- Parameters:
process
- the process to execute in a transaction.- Returns:
- the result of the process.
-
isActive
protected boolean isActive()
-
-