File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes setSessionContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "setSessionContext" Watch "setSessionContext" New topic
Author

setSessionContext

Alex
Greenhorn

Joined: Dec 19, 2003
Posts: 8
If i initialise an object via jndi lookup in the setSessionContext method of an EJB Is it possible to add this object to the context so that I can retrieve it from the context at some point much further in the transaction.
how would I add it to the context? How would I get it out of the context? Can it be done? Any code examples would be appreciated.
In addition if this EJB was a client to another EJB say EJB2 would I be able to get access to the object intialised in the sesionContext of EJB1 from EJB2?
Thanks
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

it possible to add this object to the context so that I can retrieve it from the context at some point much further in the transaction.

There is no setAttribute method in SessionContext. So you cannot add/remove objects.
[ December 19, 2003: Message edited by: Pradeep Bhat ]

Groovy
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
We cannot store/retrieve data from an EJBContext. The EJBContexts are different from the ServletContexts in a web app.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
"Java inter",
We have a naming policy, which disallows obviously fake names. Thus, I'll have to ask you to change your display name into something real-looking. You can do that here.
Thanks, and welcome to the JavaRanch!


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setSessionContext