The SessionSynchronization interface allows a stateful session bean instance to be notified by its container of transaction boundaries.
Only a stateful session bean with container-managed transaction demarcation can receive session synchronization notifications. Other bean types must not implement the SessionSynchronization interface or use the session synchronization annotations.
A stateful session bean class is not required to implement this interface.
| Modifier and Type | Method and Description |
|---|---|
| public void | afterBegin()
The |
| public void | afterCompletion(boolean
True if the transaction has been committed, false
if is has been rolled back. committed)The |
| public void | beforeCompletion()
The |
| afterBegin | back to summary |
|---|---|
| public void afterBegin() throws EJBException, RemoteException The The instance can use this method, for example, to read data from a database and cache the data in the instance fields. This method executes in the proper transaction context.
| |
| afterCompletion | back to summary |
|---|---|
| public void afterCompletion(boolean committed) throws EJBException, RemoteException The This method executes with no transaction context.
| |
| beforeCompletion | back to summary |
|---|---|
| public void beforeCompletion() throws EJBException, RemoteException The This method executes in the proper transaction context. Note The instance may still cause the container to
rollback the transaction by invoking the
| |