• +91 9971497814
  • info@interviewmaterial.com

EJB Interview Questions Answers

Question 1 : What is the difference between EJB and Java beans?

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

Question 2 : What is EJB role in J2EE?

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

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

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

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

Answer 4 : 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 5 : How can I access EJB from ASP?

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

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 : Why does EJB needs two interfaces(Home and Remote Interface)

Answer 7 : 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 8 : What are the optional clauses in EJB QL?

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

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

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

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

Answer 10 : 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)

EJB Contributors


Share your email for latest updates


Our partners