• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setSessionContext

 
Alex
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We cannot store/retrieve data from an EJBContext. The EJBContexts are different from the ServletContexts in a web app.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic