Updated March 6, 2023
Introduction to EJB Interview Questions And Answers
EJB expands as Enterprise java bean. EJB helps in building applications which are highly scalable and also it resides on the server end of the system. Developed in 1997 by IBM. It was conquered by sun microsystems in 1999. The application server manages the EJB using a container. Usage of EJB leads to a very high cost-efficient system in production. They are specifically used to apply the logic of business into the applications.
Now, if you are looking for a job which is related to EJB then you need to prepare for the 2023 EJB Interview Questions. It is true that every interview is different as per the different job profiles. Here, we have prepared the important Interview Questions and Answers which will help you get success in your interview.
In this 2023 article, we shall present the 10 most important and frequently used EJB interview questions. These interview questions are divided into two parts are as follows:
Part 1 – EJB Interview Questions (Basic)
This first part covers basic EJB Interview Questions and Answers.
Q1. Types of Enterprise Beans?
There are two major types of enterprise beans,
- Session beans: All EJB files are accessible using this interface. This interface could either be remote or allocated in local.
- Message Driven Beans: Message paradigm based asynchronous executions are supported using MDB.
Q2. How an EJB can be Stateless created?
- A local interface needs to be created
- The client application will be using this interface for all forms of communication
- @Local annotation when client environments resemble the same.
- @Remote annotation when there is a difference of client environment.
- A stateful session bean has to be generated
- Use @Stateful annotation to signify the stateful notation.
Let us move to the next EJB Interview Questions.
Q3. Key applications of EJB container?
- Management of EJB life cycle
- Container-managed transaction
- Container-managed persistently
- Cost-efficient deployment
Q4. Differentiate singleton session bean vs. stateless session bean?
This is the common EJB Interview Questions asked in an interview. Below are the difference between Singleton beans and Stateless beans are as follows:
- Stateless beans supply increased performance in the session data,
- Singleton beans, on the other hand, there is a steady decrease in performance on session data.
- Association between the objects are not established in stateless and it calls only a single method to be used at a particular point of time.
- Whereas, singleton bean permit the simultaneous process to entitle one object at a time and also maintains a rationalized file so that more than one object will not be calling the same again and again.
- The stateless bean operates on generic processes for clients. All the shared systems can parallel share the singleton bean applications and allows execution and access of multiple threads at a single time.
Q5. How to call one EJB within another EJB?
JNDI’s can be used for calling one EJB’s within other EJB’s it also helps to locate the home interface and acquiring the instance.
Part 2 – EJB Interview Questions (Advanced)
Let us now have a look at the advanced EJB Interview Questions and Answers.
Q6. Enlist the technologies embraced in J2EE.
The technologies embraced in J2EE are:
- Enterprise JavaBeansTM (EJBsTM)
- The Java Naming and Directory InterfaceTM (JNDITM)
- Java Servlets
- The JDBCTM data access API.
- The Java Transaction API (JTA)
- JavaServer PagesTM (JSPsTM)
Q7. Define Ripple effect?
A phenomenon changes on the server run time gets reflected across all the clones of the server is called ripple effect.
Let us move to the next EJB Interview Questions.
Q8. What are the ways through which the EJB control can be extended?
EJB control can be extended by carrying the following steps:
- A java interface which extends the EJB interface is created using the determined components.
- The EJB has to be verified whether it is a session bean, org.apache.beehive.controls.system.ejb.Session EJB Control is used for extending the same when the EJB is a session bean, On the other case the org.apache.beehive.controls.system.ejb.Entity EJB Control is used for extending.
- Use the Java interface with @Control Extension that resides in the following library :
(org.apache.beehive.controls.api.bean.ControlExtension). This is the way through which the Control Annotation Processor can get the control extension using the Java interface.
- EJB business and home interfaces are extended using the java bean. both the EJB’s local and business interfaces can be associated with the same entity of the object.
- EJB control for verification is mentioned. It uses JNDI name and it is used as @EJBHome.jndiName.
Q9. List some key elements in persistence API?
This is the most popular EJB Interview Questions asked in an interview. Some of the key actors in persistence API are:
- Entity Manager
- Persistence unit
- Data source
Q10. How stateful transactions maintain consistency?
On every commitment of a transaction, the fields are been updated this ensures consistency on stateful transactions.
This has been a guide to the list of EJB Interview Questions and Answers. Here we have listed the most useful 10 interview sets of questions so that the jobseeker can crack the interview with ease. You may also look at the following articles to learn more –