Wednesday, October 14, 2015

EJB Interview Questions and Answers

8. Explain briefly about the EJB components ?
  • EJB Container : It provides runtime environment for the EJB components and services, such as Life cycle management, connection pooling and security.
  • EJB Component : It is a java class that follows the Enterprise Java Bean specification to implement the business logic of an application. Enterprise Java Bean components are deployed in container and are accessed using the remote and home interfaces of an enterprise bean.
  • EJB Object : Enterprise Java Bean container generates Enterprise Java Bean object, when a client needs to access an instance of the enterprise java bean. The Enterprise Java Bean object acts as an interface between the client and bean instances.
  • Remote Interface : It declares methods, which an enterprise bean provides to clients in order to enable them to perform business operations.
  • Home Object : Home objects are generated by Enterprise Java Bean container. Clients access Enterprise Java Bean objects that are stored at different java virtual machine, using the home object.
Task performed by EJB Object
  • Creating EJB objects
  • Searching EJB Objects
  • Removing EJB Objects
EJB Interfaces
  • Home Interface : It declares the various life cycle methods that involve operations, such as creating, finding, removing enterprise beans.
  • Local Interface : These are used when the enterprise bean and the client machine are stored in the same JVM.
9. what are the system services provided by EJB container?
Container provides system services such as:
  • Persistence
  • Security
  • Transaction
  • Connection pooling
  • Component lifecycle management
  • Threading
10. Mention the steps to call a remote method in EJB?
  • The client calls a local stub that is an object of the remote interface.
  • The stub marshals the parameters of the message into a form that can be sent over the network.
  • The call is sent over the network connection to the skeleton that is present at the server.
  • The skeleton demarshals the parameter in a form suitable for calling the EJB object.
  • The skeleton calls the EJB object that provides the middleware services, such as transaction and security.
  • The EJB object calls the instance of enterprise bean.
  • The Enterprise bean instance performs the tasks that are defined in the called method.
11. Mention the steps to call an EJB using local interface?
The client calls a local object. The local object provides services, such as transactions, connection pooling and security. The local object calls the EJB bean instance, which performs the tasks defined in the method. The EJB instance returns the result and control to the local object, which returns the result to the client.
12. what are EJB design principles?
  • EJB applications are loosely coupled.
  • EJB behavior is specified by interfaces.
  • Implementation is hidden from the client.
  • The container supports the application developer.
  • EJB applications are tiered
    • The session tier is the API to the application.
    • The entity tier is the API to the data sources.

No comments: