Hi Conor,
The container does not take any responsibility for
managing the state of stateful session beans w.r.t.
transactions. These bean types are transactionally
aware, not trnasactional. And so the bean can be
notified whether a transaction has committed successfully
or rolled back, but it is upto the bean to reset its
state ( if required ).
Your stateful session bean should implement the
SessionSynchronization interface. This interface has three
notification methods which are called during different
stages of a transactions' life-cycle.
afterBegin()
- this is called at the beginning of a transaction. You should
use this method to read data from the database.
beforeCompletion()
- this method is called just prior to the transaction ending.
You should use this method to write your data to the database.
afterCompletion(boolean committed)
- this method is called just after the transaction
has completed. It notifies the bean whether the
transaction committed or rolled back. Allowing
you to take the appropriate action.
Thanks,
Jazz.
-----------------------------------
Jasbinder Singh Gill (Consultant)
Versant LTD
Tel: ++44 (0)1256 366540
Mobile: +44 (0)958 904 536
Conor Kiely wrote :
>
> Question: Does the container have any responsibilities for managing the
> state
> of attributes in a stateful session bean where a transaction might roll
> back ?
>
> I'm not talking about serializing the state on passivation.
> I'm talking about attributes modified within (say) a TX_REQUIRED
> method, which rolls back after the attribute state has been updated.
>
> Can/should the container restore the pre-transaction attribute state ?
> I can't see mention of this (or maybe I'm not 'getting' it), but it
> would be 'nice'.
>
> Conor.
>
> ==================================================================
> =========
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".