Think of something easier for a second - JDBC. Why access a DataSource to
get a Connection, why not just have all clients get the Connection directly?
Because Connections are managed resources and cannot be singletons like
DataSources; they have to be produced by some factory object. This pattern
exists throughout computing and throughout the Java API's.

Home interfaces provide similar functionality. They are just another
factrory object that produces objects your clients can use. Like all factory
objects, there is just one for all clients, and it produces individual
objects according to specific lifecycle rules for those objects. So the
factory is typically a singleton that manages the lifecycle of the stuff it
produces, and doesn't need to maintain any state for any particular client.

The objects that are produced, however, need to be created and disposed of
according to varying lifecycle and optimization rules even if they don't
maintain state on behalf of a client. Where EJB's are concerned, though,
even stateless objects are associated with client state, if only for the
duration of a transaction or method inovation -- they maintain security and
transaction contexts for that client. If every client accessed the same
object, they'd share those contexts, and the object would not be
transactable. Think of other architectures that follow such a pattern (such
as servlet implementations); are any transactable? Could they be made
transactable with such a factory pattern?

psn

on 12/8/00 11:31 AM, Naveen Chandra at [EMAIL PROTECTED] wrote:

> Hi EJB Gurus,
>
> Could some please help me in clarifying my doubt here.
>
> Why does client access an Enterprise JavaBean
> by looking up the class implementing its home interface
> by name through JNDI and then uses the methods
> of home interface to acquire access to
> an instance of the class implementing the remote interface ?
>
> Why cannot client access the remote interface directly ?
>
> By doing this    client --> EJBHome --> EJBObject
> in the EJB architecture what advantage they get ?
>
> It seems I am fully confused now with the EJB implementaion ?
>
> And why did they kept all business methods in the Remote interface and
> create and finders in home interface. I think I may be asking
> very silly questions, but it really makes me too confusing to
> understand the EJB architecture and its implementaion.
>
> Please help me to understand better the EJB architecture.
>
> Thanks,
> Naveen.
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to