EJB Interview questions »



Q) What is EJB
Rep) Enterprise JavaBeans.
Q) What is EJB container
Rep) A container that implements the EJB component contract
of the J2EE architecture. This contract specifies a
runtime environment for enterprise beans that includes
security, concurrency, life-cycle management,
transactions, deployment, naming, and other services.
An EJB container is provided by an EJB or J2EE server.
Q) What is EJB container provider
Rep) A [...]

Creating a Stateful session Bean »



To send two values to a stateful session bean and getting their sum and difference.
The program makes two conversations(calls) with the session bean. In one call it gets the sum and in the second call it gets the difference. Between the calls state is to be maintained.
1 Step) Remote interface :

import javax.ejb.*;
import java.rmi.*;
//No change from [...]

Life Cycle of stateless session bean »



Stateless session bean
The stateless session beans life cycle has two states:

does not exist state and
the method ready pool

Does not exist
When a bean instance is in the does not exist state, it is not an instance in the momory of the system.In other words, it has not been instantiated yet.
The method ready pool
Stateless bean instances enter [...]

Providing current date and time using Stateless session bean »



Development of every bean includes minimum 4 programs.

Remote interface
Home interface
Bean program
Client program

Remote interface defines all the methods (business methods) used for communication
Home interface defines methods used to connect to the bean. Bean program is the implementation program for all themethods of remote and home interfaces. Finally, a client program that invokes the business methods of [...]