EJB Interview Questions

Started by nithyasubramanian, Jan 16, 2009, 07:58 PM

Previous topic - Next topic

nithyasubramanian

EJB Interview Questions

1)   Explain about the concept of EJB?
EJB is a complex subject and it requires patience to master it. This is used for Enterprise construction of applications. It is a server side component and architecture. The main role which EJB functions is, it hides the business logic of an application.

2)   Name some common roles which EJB performs?
Enterprise Java Beans is used chiefly for encapsulating the business logic of an application. It handles problems such as security, persistence and transactional integrity of applications. It solves these major three problems of developers thus allowing them to freely concentrate on the problem at hand.

3)   Explain about POJOs which form a part of EJB?
Plain old java objects are nothing but java objects. EJB3 has implemented POJOs. It gives a feel to the developers about the old objects and names used in programming. This makes a developer comfortable rather than to use fancy names for the same old application or function.

4)   Explain in detail about stateless session bean?
Concurrent access to a bean can be possible by using stateless session bean because they don't have a state associated with them. This bean is less resource intensive due to lack of overhead which negates its functionality in calling a conversation with the program.

5)   Explain about stateful session Beans?
Stateful session beans have a state and they are distributed objects, because of them having a state they keep a track record of the calling program. This session should be carefully programmed because it may tell you about the status and presence of the customer during checkout.

6)   Explain the difference between Container managed persistence and Bean managed persistence?
If the persistent state was managed by a container present in a bean then it is called as Container managed persistence. If the own state was managed by a bean then it is called as Bean managed persistence. The chief difference lies between the management of the state by the bean or by the container.

7)   Explain about Entity bean and its features?
Entity Bean is a sever side component belonging to J2EE. Persistence can be managed either by Container or a Bean; these functions are present in Entity bean. Mostly it can be identified or sorted by a primary key. Remote references can survive a crash and can be trusted as a second source for storing data.

8)   Explain about message driven beans?
Message driven beans are primarily used to handle asynchronous JMS messages which require integration of EJB and Java messaging services. These beans behave asynchronously. Handling of an operation which does not require instant reply or response is made easy by message driven beans.

9)   Explain about the process of execution of EJBs?
EJB or Enterprise Java beans are always present in EJB container which is in turn present in an application server. Interaction of the EJB with the container and client code with container or EJB depends upon the specification. They are always included in applications in the form of javax.ejb.

10)    Explain about instance methods?
Instance methods are placed in component interface and they are attached to specific instance. There nature of being Java instances makes EJB to generate classes for these instances which act as a proxy. Code from the client end is required to invoke the method present on the generated proxies which places method arguments onto a message and this message is sent to the EJB server.

11)    Explain about class methods?
Home interface declares class methods. They are not used to find an existing entity and neither are they tied to a specific instance. These are not used for creating an EJB instance.

12)    Explain about factory method?
It is an OOD pattern and deals with designing of the objects without specifying the class of the object which would be the final end product. A separate method is defined which will be used for creating an object and this can be easily overwritten by sub classes. This method is useful in getting the desired end product.

13)    Explain about the transactions feature present in EJB?
ACID transactions and bean managed transactions should be supported by EJB container. Transactions which are container managed require declarative syntax which will be used in the deployment descriptor.

14)    Explain about deployment descriptor?
As the name indicated deployment descriptor refers to a configuration file which is deployed to a container. It is primarily used for deploying a module or application. Configuration requirements are also stated in a deployment descriptor and these should be followed by a developer while deploying an application.

15)    Explain about the naming and directory services present in EJB?
Home interface implementation object can be found using JNDI and this feature is available for clients using EJB. The same Home interface can be found by using CORBA name service. Creation and deletion of EJBs can be done from home interface and client code can find entity beans.

16)    Explain about J2EE application and its components?
Two components are present in a J2EE application they are web and enterprise Java bean. Enterprise Java bean consists of all the logic which is very much required for a web service to run. These can be stored as .jar file and can be deployed on an application server.

17)    Explain about the method ready pool?
In this stage of operation bean contains an instance in its memory. This instance of memory is present in EJB container. These instances are created at the start up and a session context is set up and ultimately this data or instance is transferred to Method ready pool stage. If it doesn't like it transfers it to remove stage.
Thanks and Regards
- Nithya Subramanian
Kenvivo Communications
http://nithya-subramanian.blogspot.com/