EJB Interview Questions and Answers - Page 2

    1 Votes

13. Mention the advantages of EJB components?

  • It supports the integration of components from different vendors.
  • Enterprise Java Bean can be authored without a detailed knowledge of the environment.
  • Applications can be assembled from separate components source.
  • An Enterprise Java Beans’s interaction with its clients is specified entirely in terms of Java interfaces.
    • Methods are exposed through interfaces that clients can call, and thereby set out a ‘contract’ between the client and the Enterprise Java Bean. 
    • Enterprise Java Bean application does not maintain resources.
    • Supports portability.


14. What are the features of EJB application?
  • Enterprise Java Beans get access to external resources (databases, legacy systems) through their container.
    • Programmer does not have to worry about resource allocation and de-allocation. It is the container’s job to manage there sources, and make the access as efficient as possible.
    • EJB container is configured by system admin not through programming APIs.
  • Defined as business logic ONLY
    • No low-level plumbing.
    • It can be reused across multiple application servers.
    • It implement interfaces that allows EJB container to manage them.
15. what are the fundamentals of EJB architecture?
  • Client view of an Enterprise Java Bean is defined strictly by interfaces.
  • Enterprise Java Beans are isolated and supported by an container.
  • Enterprise Java Bean container manages database transactions.
  • Enterprise Java Bean container manages access and security.
  • Creating and locating Enterprise Java Beans is standardized.
  • Instance can be pooled for efficiency.
  • Container manages resources.
16. How EJB are supported by the container?

EJB method calls from client are intercepted by EJB container before they are delegated to EJB beans. Proxy objects (Home object and EJB object) which are generated by container. Container encapsulates EJB beans and acts as its security manager. EJB container provides system services to EJB beans.

17. How EJB container manages access and security?

  • Container handles access control
    • Which methods are accessible to which roles.
    • Access control is declaratively specified in deployment descriptor.
    • Programmatic access control is allowed.
  • Container also provide authentication scheme
    • Bean provider should never have to code authentication procedures.

18. What EJB architecture contracts are specified in EJB specification?

Contracts are specified in EJB specification.

  • Client view contract
    • Contract between client and container.
  • Component contract
    • Contract between an Enterprise Bean and its Container.

19. what is a client view contract specified in EJB specification?

Client of an EJB can be

  • Web tier components: Servlet and JSP
  • Standalone Java application
  • Applet
  • Another EJB in same or different container
  • Web services client (in EJB 2.1)

Client view contract is comprised of:

  • Home interface for local or remote clients
  • Contains methods for creating and locating beans.
  • Logic Interface (Is called Remote interface)
  • For local or remote clients.
  • Contains business methods.

20. what is component contract specified in EJB specification?

  • Enables EJB method invocations from clients.
  • Manage the life cycle of EJB bean instances.
  • Implements home and remote interfaces.
  • Provide persistence for CMP entity beans.
  • Manage transactions, security, exceptions, etc...
  • Implements callbacks.

21. How client creates and locates EJB?

There is a well-defined way for the client to create new EJBs, or to find existing ones.

  • Client uses JNDI to get a proxy object (actually a reference to stub of a EJB Home object).
  • Client then calls either create() or find() method of the Home object to get another proxy object (actually a reference to stub of a EJB object).
  • Clients always deal with proxy objects – never directly with EJB bean instance.
  • Container may pool bean instances.
    1. Container knows when is the good time to create and remove bean instances.
    2. When a client asks container to create a bean via create() method, the container is likely to return a bean instance from the pool.
    3. This is all transparent to client.

22. What are the types of Enterprise Java Beans?

Session Beans

  • Stateful session beans
  • Stateless session beans

Entity Beans

  • Bean Managed Persistence (BMP)
  • Container Managed Persistence (CMP)
  • Message Driven Beans

23. What is a session bean?

Session bean represents a transient conversation between client and server. When the client is done with the execution, the session bean and its data are gone.

Page 2 of 4

Popular Videos


How to improve your Interview, Salary Negotiation, Communication & Presentation Skills.

Got a tip or Question?
Let us know

Related Articles

JSP Interview Questions and Answers
Servlet Interview Questions and Answers
Advanced Servlet Interview Questions and Answers
Spring Interview Questions and Answers