EJB Interview Questions and Answers
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’s new in the EJB
Following are some of the main features supported in EJB 2.0:
1. Integration of EJB with JMS,
2. Message Driven Beans,
3. Implement additional Business methods in Home interface which are not
specific for bean instance, EJB QL.
How can I access EJB
We can use the Java 2 Platform, Enterprise Edition Client Access Services
(J2EETM CAS) COM Bridge 1.0, currently downloadable from Sun
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.
Are enterprise beans
allowed to use Thread.sleep()?
Enterprise beans make use of the services provided by the EJB container,
such as life-cycle management. To avoid conflicts with these services,
enterprise beans are restricted from performing certain operations: Managing
or synchronizing threads
What is the difference between a Coarse Grained Entity
Bean and a Fine Grained Entity Bean?
A ‘fine grained’ entity bean is directly mapped to one relational table, in
third normal form. A ‘coarse grained’ entity bean is larger and more
complex, either because its attributes include values or lists from other
tables, or because it ‘owns’ one or more sets of dependent objects. Note
that the coarse grained bean might be mapped to a single table or flat file,
but that single table is going to be pretty ugly, with data copied from
other tables, repeated field groups, columns that are dependent on non-key
fields, etc. Fine grained entities are generally considered a liability in
large systems because they will tend to increase the load on several of the
EJB server’s subsystems (there will be more objects exported through the
distribution layer, more objects participating in transactions, more
skeletons in memory, more EJB Objects in memory, etc.)
What is EJBDoclet?
EJBDoclet is an open source JavaDoc doclet that generates a lot of the EJB
related source files from custom JavaDoc comments tags embedded in the EJB
What is the difference
between session and entity beans?
An entity bean represents persistent global data from the database; a
session bean represents transient user-specific data that will die when the
user disconnects (ends his session). Generally, the session beans implement
business methods (e.g. Bank.transferFunds) that call entity beans (e.g.
Is it legal to have
static initializer blocks in EJB?
Although technically it is legal, static initializer blocks are used to
execute some piece of code before executing any constructor or method while
instantiating a class. Static initializer blocks are also typically used to
initialize static fields - which may be illegal in EJB if they are
read/write - In EJB this can be achieved by including the code in either the
ejbCreate(), setSessionContext() or setEntityContext() methods
Page Numbers :