Package lumis.util
Interface ITransaction
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Subinterfaces:
ITransaction
,ITransactionHibernate
,ITransactionJdbc
,ITransactionJPA
,ITransactionSPI
- All Known Implementing Classes:
TransactionHibernate
public interface ITransaction extends java.io.Closeable
Represents a transaction that offers persistence access. An instance of transaction is not thread-safe.This interface will be replaced by
ITransaction
in a future release.- Since:
- 4.0.8
- Version:
- $Revision$ $Date$
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
addObserver(ITransactionObserver observer)
Adds an observer for this transaction.void
begin()
void
close()
Closes this transaction, rolling back any changes not committed by a previous call tocommit()
, and removes any association of this transaction from the current thread.void
commit()
void
dispose()
Deprecated.since 8.0.0 replaced byclose()
for compatibility with try-with-resources statements.java.lang.Object
getAttribute(java.lang.String name)
Returns the value of the named attribute, ornull
if no attribute of the given name exists.ITransaction
getByConnectionId(java.lang.String id)
Returns anITransaction
that represents the same transaction but that returns the connection with the given id as default.boolean
isActive()
Returns true if the transaction is currently active, false otherwise.void
removeAttribute(java.lang.String name)
Removes an attribute from this transaction.boolean
removeObserver(ITransactionObserver observer)
Removes an observer for this transaction.void
rollback()
void
setAttribute(java.lang.String name, java.lang.Object value)
Stores an attribute in this transaction.
-
-
-
Method Detail
-
begin
void begin() throws DaoException
- Throws:
DaoException
-
commit
void commit() throws DaoException
- Throws:
DaoException
-
rollback
void rollback() throws DaoException
- Throws:
DaoException
-
dispose
@Deprecated void dispose() throws DaoException
Deprecated.since 8.0.0 replaced byclose()
for compatibility with try-with-resources statements.- Throws:
DaoException
-
close
void close()
Closes this transaction, rolling back any changes not committed by a previous call tocommit()
, and removes any association of this transaction from the current thread.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Since:
- 8.0.0
-
isActive
boolean isActive()
Returns true if the transaction is currently active, false otherwise.- Returns:
- true if the transaction is currently active, false otherwise.
- Since:
- 4.1.0
-
addObserver
boolean addObserver(ITransactionObserver observer) throws PortalException
Adds an observer for this transaction. The observer is added only if the current observer list does not already contain it.- Parameters:
observer
- the observer.- Returns:
- true if the observer was added, false otherwise.
- Throws:
PortalException
- Since:
- 4.0.8
-
removeObserver
boolean removeObserver(ITransactionObserver observer) throws PortalException
Removes an observer for this transaction. If the current observer list does not contain the given observer nothing happens.- Parameters:
observer
- the observer.- Returns:
- true if the observer was removed, false otherwise.
- Throws:
PortalException
- Since:
- 4.1.0
-
getByConnectionId
ITransaction getByConnectionId(java.lang.String id) throws DaoException
Returns anITransaction
that represents the same transaction but that returns the connection with the given id as default. How the id represents the connection is defined by the concrete class that implements this interface.- Parameters:
id
- the connection id.- Returns:
- the ITransaction object.
- Throws:
DaoException
- Since:
- 4.0.4
-
getAttribute
java.lang.Object getAttribute(java.lang.String name)
Returns the value of the named attribute, ornull
if no attribute of the given name exists.Different transaction instances that refer to the same transaction (see
getByConnectionId(String)
) share the same attributes.- Parameters:
name
- the name of the attribute.- Returns:
- the value of the attribute, or null if the attribute does not exist.
- Since:
- 4.1.0
-
setAttribute
void setAttribute(java.lang.String name, java.lang.Object value)
Stores an attribute in this transaction. If the value passed in isnull
, the effect is the same as callingremoveAttribute(String)
.- Parameters:
name
- the name of the attribute.value
- the value to be stored.- Since:
- 4.1.0
-
removeAttribute
void removeAttribute(java.lang.String name)
Removes an attribute from this transaction.- Parameters:
name
- the name of the attribute.- Since:
- 4.1.0
-
-