This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why to use Home Interface to invoke remote interface

 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai all,
In programming EJB, we use Home Interface to get an object of Remote Interface and use it. why can't we use the remote interface directly.
In stateless bean normally we will not have the client info. if we need the state of the client we use stateful bean.is it possible to have the state maintained using stateless bean itself.
thanks,
bye,
siva.
 
Bill Dudney
Author
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Siva,
If I understand your question correctly you want to just use the Remote interface from your stateless/full bean?
A question for you: How would you get at the instance the Remote interface represents?
The whole idea of the Home is to be the lifecycle manager of the instances that conform to the remote interface. When you ask the home to create an instance for you a lot of stuff happens that is non-trival (recall that your connection to the actual instance is via RMI or IIOP). The Home is taking care of all that non-trivial configuration to make sure your Remote interface functions as you expect.
As to the second part of your question it seems a bit contradictory. You ask if you can just keep state in your stateless bean. If you'd like to keep state then use a stateful bean.
Hope this helps.
 
vikasids sharma
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Well EJB specification says Home object which implements Home Interface are factories for EJB objects.So whenever a stub(surrogate for ejb object at client side) is to be created, one has to go through home interface. There's no alternative to it.
2. Stateless session beans span over single method invocation. its state is managed till the method invocation lasts. No concurrent requests are serviced against same method invocation.

Originally posted by Sivaraman Lakshmanan:
hai all,
In programming EJB, we use Home Interface to get an object of Remote Interface and use it. why can't we use the remote interface directly.
In stateless bean normally we will not have the client info. if we need the state of the client we use stateful bean.is it possible to have the state maintained using stateless bean itself.
thanks,
bye,
siva.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic