Cedric Beust wrote:

> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Alvaro Mota
>
> > For example:
> >
> > Let's say I have a Person entity bean that
> > has a one-to-many relationship with an Address
> > entity bean (A Person can have many Address
> > and an address can have for one person).
> >
> > For Person:
> >
> > in PersonEJB:
> >
> > abstract Collection getAddresses();
> > abstract void setAddresses(Collection addresses);
> > void addAddress(Address address);
>
> Actually, this should read
>
> void addAddress(AddressLocal address);

This is an interesting question.  If I have an entity called "Address",
should its local interface be called "AddressLocal".  One line of
thinking is that it should, to distinguish it from its remote interface
"Address" (or "AddressRemote").  However, the vast majority of
entity beans will not have a remote interface.  Therefore, it seems
to me that just using "Address" for the local interface is preferred.

My thinking is simply that "Address" is simpler, and is really a
better description of the underlying entity.  We are talking about
an entity that represents and address, and we are talking about
the interface by which a user accesses the entity.  That should be
"Address", IMO.

In the very unusual case that you also have a remote interface on
your entity beans, then you might want to make this explicit by
calling the remote interface "AddressRemote" (but keep "Address"
for the local interface).

Interestingly, the naming convention is reversed for beans which
expose a remote interface as their "primary" interface.  So, for a
typical session bean which is exposed to clients, you would not
use the "Remote" suffix for the interface name.  Only in (obscure)
cases where the SB had both a home and a remote interface
would the explicit suffix be needed (and then only for the
secondary interface).

I am taking the time to dwell on these conventions because we are
working on the default code generation for JBuilder, and we need
to decide what the default names of beans should be.  So, my rule
is:

    * entities: default to local interface, no "Local" suffix
    * sessions: default to remote interface, no "Remote" suffix

Obviously, these defaults can be over-ridden by user preferences,
but the defaults should be mostly good.

-jkw

===========================================================================
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