You should do:




Exactly that.

Use set/unset to aquire resources you'll use and that are specific to a
transaction.

On the other hand, since B is a SLSB, you could create the instance of B in
the ejbCreate method;
It would be more efficient; and there�s no need to clean up (whenever a is
finally gc'd b will be as well).

Also, if you go for the second option, try to configure a pool for the
beans, therefore raising the gain.

My 2c, 

Juan Pablo


> -----Original Message-----
> From: Alex Paransky [mailto:[EMAIL PROTECTED]]
> Sent: Mi�rcoles, 22 de Agosto de 2001 16:51
> To: [EMAIL PROTECTED]
> Subject: Holding onto references to session beans...
> 
> 
> When stateless session bean A has a dependency on stateless 
> session bean B,
> we create an instance of B b in the a.ejbCreate method.  Similarly, we
> dispose of b in the a.ejbRemove() method.  Since the 
> stateless session beans
> are never passivated, this seems to work ok (any comments?).
> 
> However, when entity bean A a has a dependency on stateless 
> session bean B
> b, we tend to create b in each method of bean a where object 
> of type B is
> needed.  This adds to the complexity of our methods, since we 
> must make sure
> to trap all exceptions and remove a reference to object B in 
> the finally
> clause of the A's function call.
> 
> Is there a better way to have entity bean A reference 
> stateless session bean
> B?  For example, could I create a reference to SSB B in 
> A.setContext() and
> remove the reference to SSB B in A.unsetContext()?  This 
> would simplify the
> coding of functions in entity bean A.
> 
> Thanks.
> -AP_
> 
> ==============================================================
> =============
> 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".
> 
> 
> ______________________________________________________________
> ______________
> For your protection, this e-mail message has been scanned for Viruses.
> Visit us at http://www.neoris.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