David,
The Home interface design pattern is very powerful. It is basically a
Factory design pattern and allows you to create instances of servant objects
with parameters and overload the creations. If the container inlcuded its
own factory (as it did in earlier ejb implementations) then there would be
no way to initialize servants with parameters. At least not with any
parameter and in an overloaded fashion. This is especially true when
working with a stateless model where initialization lasts only for a single
method call. This is why the beans lifecycle is so complex, with stages
before initialization, during, after, etc.
Dave Wolf
Internet Applications Division
Sybase
> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of David Chen
> Sent: Tuesday, August 15, 2000 2:26 PM
> To: [EMAIL PROTECTED]
> Subject: A newbie question: why home interface is needed?
>
>
> Could someone tell me why a remote interface and a home interface
> has to be
> created for each ejb bean? I understand that the remote interface probably
> is required since it is undesirable to expose the bean class (with
> implementation) to the client. But why the home interface is needed? Could
> its "create" responsibility be owned by some sort of factory object that
> represents the containers? And the client just asks it for the
> reference to
> the bean with the remote interface name. It seems to me that it
> is simpler.
> But I am sure that the home interface probably is required and designed to
> work this way for some reasons that I don't know of. I would
> appreciate your
> thoughts on this.
>
> Thanks in advance.
>
> David
>
> ==================================================================
> =========
> 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".