Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

EJB Interview Questions and Answers For Freshers Part-1

Be First!
by December 18, 2015 EJB

ejb1.What is EJB?
EJB stands for Enterprise Java Beans. EJB is an essential part of a J2EE platform. J2EE platform have component based architecture to provide multi-tiered, distributed and highly transactional features to enterprise level applications.

EJB provides an architecture to develop and deploy component based enterprise applications considering robustness, high scalability and high performance. An EJB application can be deployed on any of the application server compliant with J2EE 1.3 standard specification.

2.What are the benefits of EJB?
Following are the key benefits of EJB.

Simplified development of large scale enterprise level application.

Application Server/ EJB container provides most of the system level services like transaction handling, logging, load balancing, persistence mechanism, exception handling and so on. Developer has to focus only on business logic of the application.

EJB container manages life cycle of ejb instances thus developer needs not to worry about when to create/delete ejb objects.

3.What is a Session Bean in EJB?
Session bean stores data of a particular user for a single session. It can be stateful or stateless. It is less resource intensive as compared to entity beans. Session bean gets destroyed as soon as user session terminates.

4.What is Stateless Session Bean in EJB?

A stateless session bean is a type of enterprise bean which is normally used to do independent operations. A stateless session bean as per its name does not have any associated client state, but it may preserve its instance state. EJB Container normally creates a pool of few stateless bean’s objects and use these objects to process client’s request. Because of pool, instance variable values are not guaranteed to be same across lookups/method calls.

5.What is Entity Bean in EJB?
Entity beans represents persistent data storage. User data can be saved to database via entity beans and later on can be retrived from the database in the entity bean.

6.What is Message Driven Bean in EJB?
A message driven bean is a type of enterprise bean which is invoked by EJB container when it receives a message from queue or topic. Message driven bean is a stateless bean and is used to do task asynchronously.

7.When a local session bean is used in EJB?
If ejb client is in same environment where ejb session bean is to be deployed then we use local session bean.

8.What a remote session bean is used in EJB?
if ejb client is in different environment where ejb session bean is to be deployed then we use remote session bean.

9.What are the differences between stateful session bean and stateless session bean?
Following are the differences between stateful session bean and stateless session bean:

EJB Container creates a separate stateful session bean to process client’s each request.whereas EJB Container normally creates a pool of few stateless bean’s objects and use these objects to process client’s request.

As soon as request scope is over, statelful session bean is destroyed but stateless bean remains active.

A stateful session bean is a type of enterprise bean which preserve the conversational state with client. A stateful session bean as per its name keeps associated client state in its instance variables Whereas because of pool of stateless session beans, instance variable values are not guaranteed to be same across lookups/method calls in stateless session beans.

10.What is Stateful Session Bean in EJB?
A stateful session bean is a type of enterprise bean which preserve the conversational state with client. A stateful session bean as per its name keeps associated client state in its instance variables. EJB Container creates a separate stateful session bean to process client’s each request. As soon as request scope is over, statelful session bean is destroyed.

(157)

Previous
Next

Leave a Reply