Hey
Andy Piper wrote:
> Consider stateless session beans providing a facade to entity beans.
> In order to access the entity beans, session bean methods need to do a JNDI
> lookup for the home and then create an entity bean from the home. To my
> mind the fact that you have to do a JNDI lookup _each time_ could make
> things quite slow and/or not scalable. What you would like to do is hold
> onto the handle for the entity bean's home. However, EJBHome is not
> serializable and doesn't have a getHandle() method so you cannot use
> stateful session beans to solve this. Alternatively if you knew the
> container was going to leave member variables of stateless session beans
> alone then you could use them, but this is not the case either.
>
> So what to do? Do I assume that JNDI is fast and scalable? But if this is
> the case why have homes in the first place.
Yes, Home lookup can be slow if you have to do it through JNDI every
time. But you don't have to do it every time.
Two solutions:
1) In the setSessionContext() simply lookup the Home-object and store it
in a variable
<plug>
2) In the setSessionContext() simply create a SmartProxy to the Home.
Same effect as above, but you also don't
* have to do the lookup manually
* if the Home object becomes unavailable the proxy will automatically
relookup it, thus making it fault-tolerant
For download of the SmartProxy package please see my homepage.
</plug>
Good luck!
/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".