Interview Questions

Which is the only method defined in the javax.ejb.Handle interface?

BEA WebLogic Questions and Answers


(Continued from previous question...)

Which is the only method defined in the javax.ejb.Handle interface?

Which is the only method defined in the javax.ejb.Handle interface?
a. getEJBHome
b. getEJBObject
c. getPrimaryKey
d. getHomeHandle


Choice B is correct. The Handle is a serializable reference to the EJBObject. The EJBObject.getHandle() method returns a Handle object. The Handle allows us to recreate an EJB object remote reference that points to the same type of session bean or the same unique bean that the handle came from.
The Handle interface specifies only one method, getEJBObject(). Calling this method returns the EJB Object from which the handle was created. After getting the object back, we can narrow or cast it to the appropriate remote interface type. The getEJBHome method is defined in the HomeHandle interface and the getPrimaryKey method in the EntityContext interface. The getHomeHandle method is defined in the EJBHome interface.

(Continued on next question...)

Other Interview Questions