Rickard �berg wrote:

> Hey
>
> If I have a bean FooBean which have two methods, doSomething and fooBar,
> of which doSomething has tx setting SUPPORTS and fooBar has REQUIRED.
> What happens if a client (without a tx) calls doSomething, and that
> method calls fooBar in the same bean? Then the fooBar method would be
> executed without a transaction since there is no EJBObject that is being
> called that can start the tx.
>
> So, is this a bad idea? (rhethoric)
>
> The workaround would be to do ctx.getEJBObject() in doSomething and call
> fooBar through that, which could start the tx.
> \

Actually this would not work. A bean identity can not service two different tx
contexts. Since doSomething is executing without a tx and fooBar requires a tx,
an exception would occur when you executed fooBar( ) on the EJBObject returned
by ctx.getEJBObject() within the doSomething method.  (There are also reentrant
considerations but that's off subject.)

--
Richard Monson-Haefel
EJB Expert for jGuru.com
( http://www.jguru.com  )

Author of Enterprise JavaBeans
Published by O'Reilly & Associates
( http://www.ejbnow.com )

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