Laird Nelson wrote:
> I think I understood this before, but its impact is just becoming
> clear to me. Is it REALLY true that I *shouldn't* do something like
> this:
> // look up session bean here via JNDI...
> sessionBean.foo();
> sessionBean.bar();
> sessionBean.baz();
>
> ...but SHOULD instead do something like this:
>
> InitialContext ctx = getTheContext();
> SomeSessionBean bean = (SomeSessionBean)ctx.lookup(name);
> bean.foo();
>
> bean = (SomeSessionBean)ctx.lookup(name);
> bean.bar();
>
> bean = (SomeSessionBean)ctx.lookup(name);
> bean.baz();
Hi Laird! I guess you're talking about stateless session beans? Then
I think the first way is fine. You can use the remote reference
sessionBean as many times as you want. But there's no guarantee that
the remote reference will access the same object within the EJB server
each time. In particular, if foo() naughtily sets some instance
(member) variable, then there's no guarantee that bar() will read the
same value for that variable.
- Rujith.
===========================================================================
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".