EJB Interview Questions and Answers
Question - 91 : - Can more than a single table be mapped in CMP?
Answer - 91 : -
No, more than one table cannot be mapped in a single CMP.
Question - 92 : - How does EJB invocation take place?
Answer - 92 : -
Home Object reference is retrieved from the Naming Service via JNDI. Home Object reference is returned to the client. The steps are:
- Created a new EJB Object via Home Object interface.
- Created an EJB Object from the Ejb Object.
- Returned an EJB Object reference to the client.
- Invoked business method by using EJB Object reference.
- Delegate requested to Bean (Enterprise Bean).
Question - 93 : - What do you mean by EJB QL?
Answer - 93 : -
A query language which provides navigation through a network comprising enterprise beans and objects which are dependent and are defined by methods of container managed persistence. EJB 2.0 was the platform for introduction of EJB QL. It defines methods of finder which are used for entity beans, which has container managed persistence and has portability across persistence managers and containers. It is helpful in two kinds of finder methods: Finder methods, which have Home interface and return objects of entity. Select methods, which remain unexposed for the client to see but which the Bean provider uses.
Question - 94 : - What do you mean by EJBDoclet?
Answer - 94 : -
JavaDoc doclet, an open source is a doclet which generates good stuff related to EJB from comment tags of custom JavaDoc, which are embedded in the source file of EJB.
Question - 95 : - What changes have been made in EJB 2.0 specifications?
Answer - 95 : -
Changes that have been made in EJB 2.0 specification are:
- JMS is integrated with EJB.
- Message Driven Beans.
- Implementing additional Business methods.
Question - 96 : - Is having static initializer blocks legal in EJB?
Answer - 96 : -
It is legal technically, but static initializer blocks have been used in executing pieces of code before the final execution of any method or constructor when a class is instantiated.
Question - 97 : - How can Enterprise JavaBeans be accessed from Active Server Pages?
Answer - 97 : -
Enterprise JavaBeans can be accessed from Active Server Pages by:
- ‘Java 2 Platform’
- Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0 which has been currently downloaded from the Sun Microsystems.
Question - 98 : - Write the basic requirement of a CMP entity based class in 2.0 from EJB 1.1?
Answer - 98 : -
The basic requirement of a CMP is an abstract class which the container extends and gets the methods implemented required for managing the relationships.
Question - 99 : - What do you mean by EJB architecture?
Answer - 99 : -
A non-visual component involving a transaction-oriented, distributed enterprise application is called Enterprise beans. They are characteristically deployed in containers of EJB and run on servers of EJB.
The three enterprise bean types are:
- Session Beans: These enterprise beans are non-persistent and can be stateless or stateful. If a conversational state is needed then, Stateful mode is preferred while Stateless paradigm is preferred for a single business process.
- Entity Beans: Entity Beans were presented in the earlier versions of EJB consisting of persistent data in distributed objects. They had the ability to be saved in different persistent data stores.
- Message Driven Beans: Asynchronous execution by means of messaging paradigm is supported. Follow the process of receiving and processing data. They are accessed only through messages and do not have a conversational state maintained.
Question - 100 : - What do you mean by re-entrant? Can you say that session beans as re-entrant? Can entity beans be specified as re-entrant?
Answer - 100 : -
If the entity bean is defined as re-entrant, then it is possible by multiple clients to associate with the Entity bean and get methods executed concurrently inside the entity bean. Synchronization is taken care of by container. There is an exception thrown when an entity beam is defined as non-re-entrant and numerous clients are connected to it concurrently to carry out a method.