aspose file troubles
The moose likes EJB and Other Java EE Technologies and the fly likes General question of EJB!! The Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "General question of EJB!!" Watch "General question of EJB!!" New topic
Author

General question of EJB!!

Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Folks,
Why do we need Home and Remote Interface in EJBs?Why can't we keep both business methods and life-cycle methods in any one interface instead of two interfaces...any specific reason.Please help me out.
Regards,
Ravi
Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
Just beginning to wrap my arms around EJB, but, for the purposes of stretching my brain and contrasting my answer with other folks, thoughts include:
* Home vs. Object interfaces give the container more flexibility in how it implements getting remote clients to instances of business logic/data. More flexibility lets containers optimize in various ways, re: caching, loading, etc.
* Once the remote client has a handle to the EJBObject stub, it may no longer need the EJBHome interface object, and so can let that object go to be garbage-collected.
* Just general, good, class/interface design where the interface doesn't attempt to accomplish two fundamentally separate kinds of things (lifecycle management vs. business methods).
Junaid Bhatra
Ranch Hand

Joined: Jun 27, 2000
Posts: 213
You can think of the Home interface as really being a factory for creating/locating your actual EJBObjects. In general it's a good design to separate your business object interface (Remote interface) from the
interface that manages the location/life-cycle of your business objects. You should not mingle up the two.
 
jQuery in Action, 2nd edition
 
subject: General question of EJB!!
 
The most intelligent Java IDE