wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes why to use Home Interface to invoke remote interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "why to use Home Interface to invoke remote interface" Watch "why to use Home Interface to invoke remote interface" New topic
Author

why to use Home Interface to invoke remote interface

Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
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.


Regards,
Sivaraman.L
Bill Dudney
Author
Ranch Hand

Joined: Sep 05, 2003
Posts: 234
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.


TTFN,<br /> <br />-bd-<br /> <br /><a href="http://www.amazon.com/exec/obidos/ASIN/0471449156/qid=1064343733/sr=2-1/ref=sr_2_1/002-8375300-3666449" target="_blank" rel="nofollow">Jakarta Pitfalls</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471146153/qid=1064343733/sr=1-2/ref=sr_1_2/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">J2EE AntiPatterns</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471462071/qid=1064343733/sr=1-3/ref=sr_1_3/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">Mastering JavaServer Faces</a> | <a href="http://bill.dudney.net/roller/page/bill" target="_blank" rel="nofollow">Blog</a> | <a href="http://www.jroller.com/page/BillDudney" target="_blank" rel="nofollow">Eclipse Blog</a> | <a href="http://www.sourcebeat.com/TitleAction.do?id=2" target="_blank" rel="nofollow">Eclipse 3 Live</a>
vikasids sharma
Ranch Hand

Joined: Aug 01, 2003
Posts: 157
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.


Thanks
Vikas Sharma
SCJP(1.4)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: why to use Home Interface to invoke remote interface