Sunday, September 6, 2009

EJB interview Questions

What is the difference between JavaBean and EJB?
A Java Bean is a software component written in the Java programming language that conforms to the JavaBeans component specification. The JavaBeans APIs became part of the “core” Java APIs as of the 1.1 release of the JDK.

The JavaBeans specification defines a Java-based software component model that adds a number of features to the Java programming language. Some of these features include:
.introspection
.customization
.events
.properties
.persistence

Enterprise JavaBeans (EJBs) are Java-based software components that are built to comply with Java’s EJB specification and run inside of an EJB container supplied by a J2EE provider. An EJB container provides distributed application functionality such as transaction support, persistence and lifecycle management for the EJBs.

What is abstract schema?
Abstract schema is part of an entity bean’s deployment descriptor which defines the bean’s persistent fields and their relationship. Abstract schema is specified for entity beans with container managed persistence. We specify the name of the Abstract schema name in the deployment descriptor. The queries written in EJB QL for the finder methods references this name. The information provided in this Abstract Schema is used by the container for persistence management and relationship management.

What is local interface. How values will be passed?
An EJB can use local client view only if it is really guaranteed that other enterprise beans or clients will only address the bean within a single JVM. With local client view, you can do pass-by-reference, which means your bean, as well as the client, will work directly with one copy of the data. Any changes made by the bean will be seen by the client and vice versa. Pass-by-reference eliminates time/system expenses for copying data variables, which provides a performance advantage.

What is Message Driven Bean?
An MDB is essentially a message consumer that can listen to a message destination or a message endpoint and gets activated when a message arrives. By design, MDBs are anonymous in nature and hence cannot be directly invoked by a client. The only way to invoke an MDB is to send a message to the destination or endpoint to which it is listening. As MDBs are stateless in nature and are not related to any specific client, they can be pooled for concurrent processing of messages.

What are the call back methods in Entity bean?
Callback methods allows the container to notify the bean of events in its life cycle. The callback methods are defined in the javax.ejb.EntityBean interface.

What are the services provided by container?
Container services are totally depends upon the “vendor implementation”. But more or less most of the vendors suppots the basic services like,
LifeCycle Management - It is Automatic.
Session Management - it is used by Developer coded callback methods…
Transaction Management - it is used by configuring deployment descriptor (DD) .
Security management - it is used by configuring deployment descriptor (DD) .
The other services, if any will be in advanced versions, and depends on Vendor specific.

1

2

3

4

5

6

7

8

9

10

11

 

No comments:

Post a Comment