• +91 9971497814
  • info@interviewmaterial.com

EJB Interview Questions Answers

Question 1 : What is EJB container?

Answer 1 : 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.

Question 2 : Can a Session Bean be defined without ejbCreate() method?

Answer 2 : The ejbCreate() methods is part of the bean’s lifecycle, so, the compiler will not return an error because there is no ejbCreate() method. However, the J2EE spec is explicit: · the home interface of a Stateless Session Bean must have a single create() method with no arguments, while the session bean class must contain exactly one ejbCreate() method, also without arguments. · Stateful Session Beans can have arguments (more than one create method)

Question 3 : Can I invoke Runtime.gc() in an EJB?

Answer 3 : You shouldn’t. What will happen depends on the implementation, but the call will most likely be ignored.

Question 4 : What are the optional clauses in EJB QL?

Answer 4 : WHERE and ORDERBY clauses are optional in EJB QL where as SELECT and FROM are required clauses.

Question 5 : Why does EJB needs two interfaces(Home and Remote Interface)

Answer 5 : Home Interface is the way to communicate with the container which is responsible for creating , locating and removing beans and Remote Interface is the link to the bean that allows acces to all methods and members.

Question 6 : What is the difference between ejbCreate() and ejbPostCreate

Answer 6 : The purpose of ejbPostCreate() is to perform clean-up database operations after SQL INSERTs (which occur when ejbCreate() is called) when working with CMP entity beans. ejbCreate() is called before database INSERT operations. You need to use ejbPostCreate() to define operations, like set a flag, after INSERT completes successfully.

Question 7 : How can I access EJB from ASP?

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

Question 8 : What’s new in the EJB 2.0 specification?

Answer 8 : 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.

Question 9 : What is the new basic requirement for a CMP entity bean class in 2.0 from that of ejb 1.1?

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

Question 10 : What is EJB role in J2EE?

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

EJB Contributors

krishan

Share your email for latest updates

Name:
Email:

Our partners