By Padmavathi (Jr. Faculty), NIT
yespadmavathi@gmail.com
EJB - Interview Questions
What is the relationship between local interfaces and container-managed relationships? - Entity beans
that have container-managed relationships with other entity beans, must be accessed in the same local
scope as those related beans, and therefore typically provide a local client view. In order to be the target
of a container-managed relationship, an entity bean with container-managed persistence must provide
a local interface.
What does a remove method do for different cases of beans? - Stateless Session : Does not do anything
to the bean as moving the bean from free pool to cache are managed by the container depending on
load. Stateful Session: Removes the bean from the cache. Entity Bean: Deletes the bean (data) from
persistent storage
How does a container-managed relationship work? - An entity bean accesses related entity beans by
means of the accessor methods for its container-managed relationship fields, which are specified by the
cmr-field elements of its abstract persistence schema defined in the deployment descriptor. Entity bean
relationships are defined in terms of the local interfaces of the related beans, and the view an entity
bean presents to its related beans is defined by its local home and local interfaces. Thus, an entity bean
can be the target of a relationship from another entity bean only if it has a local interface.
What is the new basic requirement for a CMP entity bean class in 2.0 from that of ejb 1.1? - It must be
abstract class. The container extends it and implements methods which are required for managing the
relationships
What are the basic classes required in the client for invoking an EJB? -
The home and the remote interfaces, the implementation of the Naming Context Factory, the stubs and
skeletons. In some App servers the stubs and the skeletons can be dynamically downloaded from the
server
What is the difference between Message Driven Beans and Stateles