You could of course, use a combination of 1 & 2 using a stateful session
bean...
public MySessionBean implements SessionBean {
...
private UserTransaction utx=null;
public void methodA() {
utx = ctx.lookup("java:comp/env/UserTransaction");
utx.begin();
//writes to DB - omitted
}
public void methodB() {
//writes to DB...
if (someCondition)
utx.rollback();
}
public void methodC() {
utx.commit();
}
}
This would allow for user interaction in the middle of a transaction (in
contrast to before the tx)
HTH
JP
> -----Original Message-----
> From: Ian McCallion [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 19, 2001 12:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: CMT source code that spans methods
>
>
> Venkatachalam Ravindran wrote:
> >
> > Thanks for pointing out the vendors product documentation.
> >
> > I want CMT where the transaction spans methods.
> >
> > The built-in examples completes within a method itself. It
> is too simple.
> >
> > Please do let me know, where I can see a program like I want.
>
> and Victor Langelo wrote:
> >
> > You have too options:
> >
> > 1. Create a session bean method that preforms the entire
> transaction by calling
> > other bean methods.
> > 2. Have the ejb client manage the transaction using the
> UserTransaction object.
> >
> > --Victor
>
> I don't think this is true. It is perfectly possible to have
> a transaction that
> the client knows nothing about spanning multiple
> transactions. See pages 164 and
> 165 of the EJB 1.1 spec for an example.
>
>
> Ian McCallion
> Alexis Systems Limited
> Romsey, UK
>
> ==============================================================
> =============
> 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".