EJB(Enterprise JavaBeans) Interview Questions & Answers

  1. Question 1. What Is The Difference Between Ejb And Java Beans?

    Answer :

    EJB is a specification for J2EE server, not a product.
    Java beans may be a graphical component in IDE.

  2. Question 2. What Is Ejb Role In J2ee?

    Answer :

    EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.

  3. J2EE Interview Questions

  4. Question 3. What Is Enterprise Javabeans (ejb) Container?

    Answer :

    1.It manages the execution of enterprise beans for J2EE applications.
    2.Enterprise beans and their container run on the J2EE server.

  5. Question 4. What Is In-memory Replication?

    Answer :

    The process by which the contents in the memory of one physical m/c are replicated in all the m/c in the cluster is called in-memory replication.

  6. J2EE Tutorial

  7. Question 5. What Is Ripple Effect?

    Answer :

    The process of propagating the changes in the properties of a server group during runtime to all the associated clones is called Ripple Effect.

  8. Core Java Interview Questions

  9. Question 6. What Is A Clone?

    Answer :

    The copies of a server group are called Clones. But unlike a Server Group Clones are associated with a node and are real server process running in that node.

  10. Question 7. What Are The Types Of Scaling?

    Answer :

    There are two types of scaling: Vertical Scaling and Horizontal Scaling.
    Vertical Scaling – When multiple server clones of an application server are defined on the same physical m/c, it is called Vertical Scaling. The objective is to use the processing power of that m/c more efficiently.
    Horizontal Scaling – When Clones of an application server are defined on multiple physical m/c, it is called Horizontal Scaling. The objective is to use more than one less powerful m/c more efficiently.

  11. Core Java Tutorial
    JDBC Interview Questions

  12. Question 8. What Is A Server Group?

    Answer :

    A server group is a template of an Application Server(and its contents) i.e, it is a logical representation of the application server. It has the same structure and attributes as the real Application Server, but it is not associated with any node, and does not correspond to any real server process running on any node.

  13. Question 9. What Is The New Basic Requirement For A Cmp Entity Bean Class In 2.0 From That Of Ejb 1.1?

    Answer :

    It must be abstract class. The container extends it and implements methods which are required for managing the relationships

  14. JSP Interview Questions

  15. Question 10. What’s New In The Ejb 2.0 Specification?

    Answer :

    Following are some of the main features supported in EJB 2.0:
    1. Integration of EJB with JMS.
    2. Message Driven Beans.
    3. Implement additional Business methods in Home interface which are not specific for bean instance, EJB QL.

  16. JDBC Tutorial

  17. Question 11. How Can I Access Ejb From Asp?

    Answer :

    We can use the Java 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0, currently downloadable from Sun

  18. Android Interview Questions

  19. Question 12. What Is The Relationship Between Local Interfaces And Container-managed Relationships?

    Answer :

    Entity beans that have container-managed relationships with other entity beans, must be accessed in the same local scope as those related beans, and therefore typically provide a local client view. In order to be the target of a container-managed relationship, an entity bean with container-managed persistence must provide a local interface.

  20. J2EE Interview Questions

  21. Question 13. What Is Ejbdoclet?

    Answer :

    EJBDoclet is an open source JavaDoc doclet that generates a lot of the EJB related source files from custom JavaDoc comments tags embedded in the EJB source file.

  22. JSP Tutorial

  23. Question 14. What Is The Difference Between Session And Entity Beans?

    Answer :

    An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)

  24. Question 15. Is It Legal To Have Static Initializer Blocks In Ejb?

    Answer :

    Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields – which may be illegal in EJB if they are read/write – In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods

  25. JMS(Java Message Service) Interview Questions

  26. Question 16. What Are Transaction Isolation Levels In Ejb?

    Answer :

    1. Transaction_read_uncommitted- Allows a method to read uncommitted data from a DB(fast but not wise).
    2. Transaction_read_committed- Guarantees that the data you are getting has been committed.
    3. Transaction_repeatable_read – Guarantees that all reads of the database will be the same during the transaction (good for read and update operations).
    4. Transaction_serializable- All the transactions for resource are performed serial.

  27. Android Tutorial

  28. Question 17. Can Entity Beans Have No Create() Methods?

    Answer :

    Yes. In some cases the data is inserted NOT using Java application, so you may only need to retrieve the information, perform its processing, but not create your own information of this kind.

  29. JavaServer Faces (JSF) Interview Questions

  30. Question 18. What Is Software Architecture Of Ejb?

    Answer :

    Session and Entity EJBs consist of 4 and 5 parts respetively:
    1. A remote interface (a client interacts with it).
    2. A home interface (used for creating objects and for declaring business methods).
    3. A bean object (an object, which actually performs business logic and EJB-specific operations).
    4. A deployment descriptor (an XML file containing all information required for maintaining the EJB) or a set of deployment descriptors (if you are using some container-specific features).
    5.A Primary Key class – is only Entity bean specific.

  31. Core Java Interview Questions

  32. Question 19. What Is Ejb Ql?

    Answer :

    1.EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence.
    2.EJB QL is introduced in the EJB 2.0 specification.
    3.The EJB QL query language defines finder methods for entity beans with container managed persistence and is portable across containers and persistence managers.
    4.EJB QL is used for queries of two types of finder methods:
                   Finder methods that are defined in the home interface of an entity bean and which return entity objects.Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.

  33. JavaServer Faces (JSF) Tutorial

  34. Question 20. How Ejb Invocation Happens?

    Answer :

    1: Retrieve Home Object reference from Naming Service via JNDI.
    2: Return Home Object reference to the client.
    3: Create me a new EJB Object through Home Object interface.
    4: Create EJB Object from the Ejb Object
    5: Return EJB Object reference to the client.
    6: Invoke business method using EJB Object reference.
    7: Delegate request to Bean (Enterprise Bean).


  35. Java collections framework Interview Questions

  36. Question 21. What Are The Call Back Methods In Entity Bean?

    Answer :

    Callback methods allows the container to notify the bean of events in its life cycle. The callback methods are defined in the javax.ejb.EntityBean interface.

  37. Question 22. What Is Message Driven Bean?

    Answer :

    1.An MDB is essentially a message consumer that can listen to a message destination or a message endpoint and gets activated when a message arrives.
    2.By design, MDBs are anonymous in nature and hence cannot be directly invoked by a client.
    3.The only way to invoke an MDB is to send a message to the destination or endpoint to which it is listening.
    4. As MDBs are stateless in nature and are not related to any specific client, they can be pooled for concurrent processing of messages.


  38. Java 8 Tutorial

  39. Question 23. What Are The Services Provided By Container?

    Answer :

    Container services are totally depends upon the “vendor implementation”. But more or less most of the vendors suppots the basic services like,
    LifeCycle Management – It is Automatic.
    Session Management – it is used by Developer coded callback methods…
    Transaction Management – it is used by configuring deployment descriptor (DD) .
    Security management – it is used by configuring deployment descriptor (DD) .
    The other services, if any will be in advanced versions, and depends on Vendor specific.

  40. Java 8 Interview Questions

  41. Question 24. What Is Deployment Descriptor?

    Answer :

    Deployment descriptor is a XML file. which is used to locate the web applicatio n by container.it includes the details of respective bean.

  42. JDBC Interview Questions

  43. Question 25. How Many Ejb Objects Are Created For A Bean?

    Answer :

    For a Session bean – one EJB object for one bean instance.
    For entity bean – it depends , if 2 users are accessing one row at time then one EJB object is used for both the beans other wise for each bean one EJB object.

  44. JAVA Persistence API (JPA) Tutorial

  45. Question 26. What Is Re-entrant. Is Session Beans Reentrant. Is Entity Beans Reentrant?

    Answer :

    If we define the entity bean as being reentrant, multiple clients can connect to the Entity bean & execute methods within the entity bean concurrently. Container takes care of synchronization. If we define the entity bean as non-reentrant and many clients connect to it concurrently to execute a method, exception is thrown .


  46. Java Collections Interview Questions

  47. Question 27. What Is Ejb Client Jar File?

    Answer :

    An EJB client JAR file is an optional JAR file that can contain all the class files that a client program needs to use the client view of the enterprise beans that are contained in the EJB JAR file. If you decide not to create a client JAR file for an EJB module, all of the client interface classes will be in the EJB JAR file.

  48. JSP Interview Questions

  49. Question 28. What Is Ejb Container?

    Answer :

    An EJB container is a run-time environment that manages one or more enterprise beans. The EJB container manages the life cycles of enterprise bean objects, coordinates distributed transactions, and implements object security. Generally, each EJB container is provided by an EJB server and contains a set of enterprise beans that run on the server.


  50. Question 29. What Is Remote Client View?

    Answer :

    1.The remote client view specification is only available in EJB 2.0.
    2. The remote client view of an enterprise bean is location independent.
    3.A client running in the same JVM as a bean instance uses the same API to access the bean as a client running in a different JVM on the same or different machine.
    Remote interface: The remote interface specifies the remote business methods that a client can call on an enterprise bean.
    Remote home interface: The remote home interface specifies the methods used by remote clients for locating, creating, and removing instances of enterprise bean classes.


  51. Java Exception Handling Interview Questions

  52. Question 30. What Is Local Client View?

    Answer :

    1.The local client view specification is only available in EJB 2.0. Unlike the remote client view, the local client view of a bean is location dependent.
    2.Local client view access to an enterprise bean requires both the local client and the enterprise bean that provides the local client view to be in the same JVM.
    3.The local client view therefore does not provide the location transparency provided by the remote client view. Local interfaces and local home interfaces provide support for lightweight access from enterprise bean that are local clients.
    4.Session and entity beans can be tightly couple with their clients, allowing access without the overhead typically associated with remote method calls.