On Fri, 5 Mar 1999, Sachin Aggarwal wrote:

> > Also, I wonder what the
> > implementation would look like; for example, if you store the state at the
> > beginning of the transaction, store it again if the transaction succeeds,
> > and load it from the store if the transaction fails, haven't you just
> > created an entity bean under another name?
>
> Good point. That's why I sometimes wonder if my stateful sesions beans are
> going to end up behaving as entity beans - maybe they should be modeled so.
>
> One question - if it were an entity bean - I'm assuming that on a rollback
> the EJB server not only send the rollback to the underlying dbms but also
> reloads the bean. Right ?


The short version: Right.

The long version:
Well, I crawled through the spec looking for an explicit statement to this
effect, with no luck. (Note to spec authors: it'd be helpful to include a
diagram in section 9.11 showing the effect of rollback on each of the
three approaches described on page 83).

However, section 9.4.2 says:

public void ejbLoad();

The container must invoke this method on the instance whenever it becomes
necessary for the instance to synchronize its instance state from its
state in the database.


>From this, it follows that you can rely on the state of your entity object
to be consistent with the (rolled-back) database the next time you use it.
Since the container can only restore the object to a state consistent with
that of the database after a rolled-back transaction by invoking
ejbLoad(), it follows that it _must_ do so).

(From the sequence diagrams in section 9.11.5, it's apparent that
ejbLoad()  will be called before the next business method invocation for
approaches B and C on page 83, but the diagram for approach A simply says,
"do nothing". It follows that  an object using approach A will invoke
ejbLoad() after a rollback to restore its state to a prior sane state, but
I couldn't find this explicitly illustrated anywhere).

===========================================================================
                Tom Valesky   -- [EMAIL PROTECTED]
                     http://www.patriot.net/users/tvalesky

===========================================================================
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".

Reply via email to