60 REAL TIME EJB ENTERPRISE JAVA BEANS Interview Questions and Answers

List of top EJB ENTERPRISE JAVA BEANS Interview Questions and Answers for freshers beginners and experienced pdf free download.

EJB interview Questions and Answers :-

1. What is EJB?

A server-side component, which manages the architecture for constricting enterprise applications and managed is called Enterprise JavaBeans(EJB).

2. When was EJB developed?

EJB was developed by IBM in 1997.

3. Who took over EJB?

EJB was taken over by Sun Microsystems in 1999.

EJB ENTERPRISE JAVA BEANS Interview Questions and Answers

EJB Interview Questions and Answers

4. Enlist the Enterprise Beans types?

They are:

  • Session Beans: Expanded as “Stateful”,”Stateless” and “Singleton”, A Remote or Local interface is used to access the EJB files.
  • Message Driven Beans (MDB): Asynchronous execution by means of messaging paradigm is supported.

5. What were Entity Beans?

Entity Beans were presented in the earlier versions of EJB consisting of persistent data in distributed objects.

6. Enlist the Declarative Transaction types?

They are:


7. What are versions of EJB?

  • EJB 3.1
  • EJB 3.2
  • EJB 3.2 Final Release (2013-05-28)
  • EJB 3.1 Final Release (2009-12-10)
  • EJB 3.0 Final Release (2006-05-11)
  • EJB 2.1, Final Release (2003-11-24)
  • EJB 2.0 Final Release (2001-08-22)
  • EJB 1.1 Final Release (1999-12-17)
  • EJB 1.0 (1998-03-24)

8. What is J2EE?

A collection of synchronized specifications and procedures, which enable solutions regarding deploying, developing supervising multi-tier server-centric applications, is called J2EE.

9. Enlist the changes in EJB 2.1 ?

The changes made are:

  • Message Driven Beans (MDBs): messages are accepted from other sources besides JMS.
  • EJB Query Language: New functions had been added.
  • Web services supported.
  • EJB Timer Service: Mechanism based on an event to invoke EJBs at particular times.
  • XML schema
  • Message destinations

10. Enlist the contents of Container. • Container contains?

  • Security support: Used to configure Deployment Descriptor (DD)
  • Persistence support: Used to be persistence in transactions.
  • Transaction management support: Used to configure Deployment Descriptor (DD)
  • Management of Session: Callback methods such as ejbStore (), ejbLoad () are used in the Developer.
  • Management of Life Cycle: Automatic

11. Differentiate ‘Stateful Session’ from ‘Entity Bean’ ?

While both undergo activation and passivation; EB have ejbStore () callback to save state through passivation and ejbLoad () callback to load state through activation. But in case of SS, this is not needed because S.S.B fields are serialized through objects by containers.

12. Which is more beneficial: Stateful or Stateless Bean?

If a conversational state is needed then, Stateful mode is preferred while Stateless paradigm is preferred for a single business process.

13. Which is more beneficial: CMP or BMP?

When “one to one” mapping is involved, and the data is stored persistently is regional database, CMP is preferred. But when no “one to one” mapping is there and data is retrieved from numerous tables having a complex query, Bean Managed Persistence is used.

14. How is consistency maintained by Stateful Session through transaction updates ?

The data consistency is maintained by updating their fields every time a commitment of the transaction is made.

15. Is ejbCreate () method mandatory while defining a Session Bean?

EjbCreate () as being part of the bean’s lifecycle, therefore, it is not mandatory for ejbCreate () method to be present and there will be no errors returned by the compiler.

16. Define Context?

This is a method of binding a name to a specific object by giving an interface like javax.naming.Context.

17. Define Initial Context?

Implementation of available methods in the interface of context such as a context called javax.meaning.InitialContext.

18. Define SessionContext ?

An EJBContext object, the SessionContext is used for accessing the information and container services.

19. Can remove () be a Stateless Session bean?

Yes, remove () can be a Stateless Session bean because the life remains the same till the method is executed.

20. Is state maintained by a Stateless bean?

A Stateless bean contains no-client specific state through client-invoked methods.

21. Can EJB made to handle multiple transactions?

EJB can be made to handle multiple transactions by enabling multiple Entity beans to handle every database and one Session Bean to retain transaction with the Entity Bean.

22. Enlist the CallBack methods of Session Bean?

public interface javax.ejb.SessionBean extends javax.ejb.EnterpriseBean {

Public abstract void ejbCreate();

public abstract void ejbRemove();

Public abstract void ejbActivate (); public abstract void setSessionContext(SessionContext ctx); public abstract void ejbPassivate();


23. Enlist the CallBack methods of Entity Bean.

public interface javax.ejb.EntityBean extends javax.ejb.EnterpriseBean {

public abstract void ejbRemove();

public abstract void ejbActivate();

public abstract void ejbStore();

public abstract void ejbPassivate(); public abstract void setEntityContext(EntityContext ctx); public abstract void unsetEntityContext(); public abstract void ejbLoad();


24. How can one EJB be called from within another EJB?

An EJB can be called within another EJB by using JNDI which can be used for locating the Home Interface and acquiring the instance.

25. Differentiate Conversational from Non-conversational interactions?

The interaction between the client and the bean is called conversational while where multi method conversations are not held with clients it is known as non-conversational interactions.

26. Define  ejb Create() and  EjbPostCreate ()?

When the method is called before the persistence storage is written with the bean state, it is ejbCreate ().

When the method is called after the persistence storage is written with the bean state, it is ejbPostCreate ().

27. Define EAR, WAR and JAR ?

JAR files contain all EJB classes.

WAR files contain all servlets, web component pages, gif, html, beans, applets, classes and classes.

EAR files contain both JAR and WAR files.

28. Differentiate Phantom from Un-repeatable?

When data that did not existed before is inserted, it is read as phantom whereas when data that already existed is changed, un-repeatable occurs.

29. Define ACID Properties?

ACID is Atomicity, Consistency, Isolation and Durability.

  • Atomicity: Operations that are bundled together and projected a single unit of job.
  • Consistency: Guarantees that after a transaction has taken place, there will be consistency.
  • Isolation: Helps protect viewing of other simultaneous incomplete transaction results.
  • Durability: Ensures durability by keeping a transitional log by which the permanent data be recreated by again applying the steps involved.

30. What do you mean by ‘Hot deployment’ ?

The act of redeployment, deployment and un-deployment in Web logic when the server is running in EJB is called Hot Deployment.

31. How can a session bean be configured for transactions of bean-managed?

It can be done by setting transaction-attribute in the deployment sector or XML file.

32. Enlist the technologies embraced in J2EE.

The technologies embraced in J2EE are:

  • Enterprise JavaBeansTM (EJBsTM)
  • JavaServer PagesTM (JSPsTM)
  • Java Servlets
  • The Java Naming and Directory InterfaceTM (JNDITM)
  • The Java Transaction API (JTA)
  • The JDBCTM data access API.

33. What do you mean Enterprise JavaBeans (EJB) container?

Enterprise JavaBeans container helps in managing the implementation of enterprise beans applications of J2EE.

34. What do you mean by in-memory replication?

When the contents having the memory of a single physical m/c are simulated in all m/c in that cluster, that process is called memory replication.

35. Define Ripple Effect?

During runtime, when the changes made in the various properties of server group, are propagated in every associated clone, this process is known as Ripple Effect.

36. Define Clone?

Server group copies are defined as clone. But unlike Server Groups, clones are linked by means of nodes.

37. What do you mean by bean managed transaction?

If the Container is not wanted by the developer for managing transactions, every database operation can be implemented to write the suitable JDBC code.

38. Differentiate, “find a method” from “select method” in EJB ?

A persistent field is returned by the select method of an entity bean that is related.  A remote or local interface is returned by the finder method.

39. What do you mean by abstract schema?

An element of an entity’s bean’s deployment descriptor that defines the persistent fields of bean’s and the relationship existing between them is known as Abstract Schema. It is specific for each entity beans which has managed persistence of container.

40. What do you mean by re-entrant? Can you say that session beans as re-entrant? Can entity beans be specified as re-entrant?

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.

41. What do you mean by EJB architecture?

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.

42. Write the basic requirement of a CMP entity based class in 2.0 from EJB 1.1?

The basic requirement of a CMP is an abstract class which the container extends and gets the methods implemented required for managing the relationships.

43. How can Enterprise JavaBeans be accessed from Active Server Pages?

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.

44. Is having static initializer blocks legal in EJB?

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.

45. What changes have been made in EJB 2.0 specifications?

Changes that have been made in EJB 2.0 specification are:

  • JMS is integrated with EJB.
  • Message Driven Beans.
  • Implementing additional Business methods.

46. What do you mean by EJBDoclet?

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.

47. What do you mean by EJB QL?

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.

48. How does EJB invocation take place?

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).

49. Can more than a single table be mapped in CMP?

No, more than one table cannot be mapped in a single CMP.

50. Are entity beans allowed to create () methods?

Yes, it is allowed in cases where data is not inserted by using Java application.

51. What is the InfoBus?
The InfoBus is a compact Java API which allows cooperating applets or Beans, on a Web page or in any other Java application, to communicate data to one another. The InfoBus architecture enables Beans to be categorized as “data providers” and “data consumers”. Data providers are Beans whose primary function is to access data from their native store, such as a DBMS, spreadsheet, flat file, Lotus Notes database etc., and to offer data onto the InfoBus.

Data consumers retrieve data from the bus, for analysis or visual display. This segregation of provider from consumer is extremely powerful in that it enables applications to be independent of their data; for example, a charting Bean need not understand SQL or JDBC in order to access DBMS data.

Of course, a Bean can be both a consumer and provider: for example a spreadsheet may accept data from a DBMS and provide data to a chart Bean.

52. Does the InfoBus compete with JavaBeans?
On the contrary, InfoBus extends the power of JavaBeans to a new range of more dynamic applications. InfoBus is fully compatible with JavaBeans, and Lotus enthusiastically supports JavaBeans as the component standard for Java. Wherever possible, InfoBus uses the existing mechanisms of JavaBeans.

53. Is InfoBus easy to use?
Using InfoBus aware components, such as the ESuite components from Lotus, users can easily construct powerful data driven applications. No programming or scripting is required: simple parameters are used to establish connections to databases and to select data for processing. For developers creating InfoBus components, InfoBus offers a straightforward API compatible in style with other features of JavaBeans.

54. JavaBeans has mechanisms like bound properties for data transfer between components. Why is the InfoBus necessary?
JavaBeans mechanisms, such as bound properties, are very useful in cases where the type of data to be communicated can be hard-coded into the source and target components. The InfoBus adds additional features required for more dynamic data interchange. These can be cases where communication is driven by the content of the data and where the nature of the data to be exchanged is determined at runtime.

55. Can both Java applets and JavaBeans components use the InfoBus?

56. Can JavaBeans use DCOM as its network model?
JavaBeans works with any network model (i.e., to communicate between components across the network), including CORBA, DCOM, etc. JavaBeans integrates well with CORBA IDL, which is an excellent solution for customers in a heterogeneous distributed computing environment with platform independent components. However, we recommend RMI for Java to Java inter-object communication.

57. Why would a developer need the JavaBeans Migration Assistant for ActiveX?
Many of the capabilities that are so exciting to JavaBeans developers are not available on ActiveX, or are incomplete. There is, therefore, a need for a set of conversion conventions and tools designed to convert desktop ActiveX components into JavaBeans components. The resulting Beans will be usable in both in new network savvy e-business applications as well as traditional desktop applications, includingActiveX containers. Developers and customers benefit from the advantages offered by JavaBeans by simply leveraging their current investments in ActiveX.

58. How and when will the JavaBeans Migration Assistant to ActiveX be available?
IBM plans to ship the JavaBeans Migration Assistant for ActiveX in Taligent’s Visual Age, WebRunner Toolkit, and Visual Age for Java development tools. This will allow developers to utilize a common component model that may be leveraged by a wide range of tools, including the IBM Visual Age for Java family.

59. How to implement a bound property in your bean application?
To implement a bound property in the application, follow these steps:

► Import the java.beans package. This gives you access to the PropertyChangeSupport class.
► Instantiate a PropertyChangeSupport object. This object maintains the property change listener list and fires property change events. You can also make your class a PropertyChangeSupport subclass.
► Implement methods to maintain the property change listener list. Since a PropertyChangeSupport subclass implements these methods, you merely wrap calls to the property-change support object’s methods.
► Modify a property’s set method to fire a property change event when the property is changed.

60. What is the relationship between Enterprise JavaBeans and JavaBeans?
Enterprise JavaBeans extends the JavaBeans component model to handle the needs of transactional business applications.

EJB(Enterprise JavaBeans) Interview Questions and Answers pdf free download ::

Add Comment

Required fields are marked *. Your email address will not be published.