On Thu, 25 Feb 1999, Joel Nylund wrote:
> 1st, is it considered bad form to hold onto an entity bean as an ivar of
> a statefull session bean.
Not unless you try to serialize it when passivation occurs.
> For example if I have a session bean that does a lot of interaction with
> an entity bean, it might save time to just hold onto it.
>
> 2nd, if it isnt bad form, or if I wanted to do it anyway, how would the
> pasivation of the session bean work.
Interesting question. Since there's really no close() call for EJBs
(remove() will actually punt the bean from the underlying store, which you
probably don't want), I'd just assign a null to the bean reference in
ejbPassivate() and reobtain it in ejbActivate().
> For example, I create a session bean A, it gets a reference to entity
> bean B (which is persistent to a RDBMS).
>
> When the server wants to passivate A (say its getting full up), it
> serializes it, and all of its references. Does this mean it will also
> serialize the Entity bean? Or is it smart enough to remember how to just
> re-find the entity bean , and let it passivate itself.
It's not smart enough.
> I guess the concern here, is it possible to have a entity bean
> serialized to disk and in the rdbms. If so, it seems like this could
> cause problems.
In general, you shouldn't serialize references to resources (files,
sockets, EJBs) when a bean is passivated. Close them out and reobtain them
later.
I'm sure Rickard Oberg will be happy to tell you about his Smart Proxies,
and how they address this particular difficulty. :-)
===========================================================================
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".