Hey
Purushottam Yeluripati wrote:
> I would appreciate some help with a problem I have been trying to
> solve, but (obviously!) haven't been able to.
> I have an instance of an entity EJB with CMP (Bean A). This bean holds
> references (by references, I mean EJBObject instances) to two other
> entity EJBs also with CMP(Beans B and C). Can I be sure that at any
> point in time, my EJBObject instances (to beans B and C) will be valid?
> I ask this because, I am not sure about the way a container handles the
> private attributes of an entity bean with CMP. Is there a way in which I
> can ensure that the references I hold are *good*? I normally obtain the
> interfaces to beans B and C in my setEntityContext method of bean A as I
> need these instances for the lifetime of bean A. And bean A's lifetime
> coould be forever! If I do need to 'refresh' by bean EJBobject
> instances, how can I achieve that and where should this be done.
> My first shot at this was that I should obtain the Handle object from
> the EJBObject (I am not sure if I can, coz I could not quite make it out
> from the spec) and store this handle as a container managed attribute.
> Whenever the container calls the ejbLoad method, I should perform the
> reverse. The only hitch to this is that I feel it is very expensive to
> have this functionality in the ejbLoad method (which could be called a
> number of times???). The next logical place I coudl have this piece of
> code is the ejbActivate I guess. But then....
Getting the handle and storing it as a attribute would be the "normal"
way. As you note however, this can be quite expensive. Smart containers
should be able to manage the EJBObject instead: whenever the beans needs
to be ejbStore:d the container should check if it's an EJBObject, if so
it should get the Handle and store it, thus saving you the trouble of
converting back and forth. Vendors: anyone doing this?
To get around the performance problem I suggest that you use lazy
loading of the EJBObjects, either by coding it manually or by using my
SmartProxy package (see my homepage) which will do this automatically
for you.
/Rickard
--
Rickard �berg
Computer Science student@LiTH
@home: +46 13 177937
Email: [EMAIL PROTECTED]
Homepage: http://www-und.ida.liu.se/~ricob684
===========================================================================
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".