Vous êtes sur la page 1sur 1

What is the need of Remote and Home interface.

Why cant it be in
one?
The main reason is because there is a clear division of roles and
responsabilities between the two interfaces. The home interface is your
way to communicate with the container, that is who is responsable of
creating, locating even removing one or more beans. The remote
interface is your link to the bean, that will allow you to remotely access to
all its methods and members. As you can see there are two distinct
elements (the container and the beans) and you need two different
interfaces for accessing to both of them.
Can I develop an Entity Bean without implementing the create()
method in the home interface?
As per the specifications, there can be 'ZERO' or 'MORE' create() methods
defined in an Entity Bean. In cases where create() method is not
provided, the only way to access the bean is by knowing its primary key,
and by acquiring a handle to it by using its corresponding finder method.
In those cases, you can create an instance of a bean based on the data
present in the table. All one needs to know is the primary key of that
table. i.e. a set a columns that uniquely identify a single row in that table.
Once this is known, one can use the 'getPrimaryKey()' to get a remote
reference to that bean, which can further be used to invoke business
methods.

Vous aimerez peut-être aussi