Question: --------- Identify how a client can obtain a reference to an existing entity object's remote interface? [Check all correct answers]
1. Invoke the findByPrimaryKey() finder method. 2. Invoke the getHandle() method on the remote interface. 3. Call a create() method on the remote interface. 4. Execute a home business method that returns the reference. 5. Call the getRef() method on the remote interface.
I answered: only 1 - This is incorrect My Reasoning is as below: To me answer 2 was wrong, because getHandle() returns Handle and not EJBObject. I know one can get EJBObject from Handle. Another point is we are calling getHandle() on EJBObject which itself is entity object's remote interface. So what's the point in doing it.
Explaination: ------------- Answer 1, 2 and 4 are correct. Answer 3 is incorrect, the create() method will not return a reference to an existing entity object's remote interface. Answer 5 is incorrect, this method does not exists.
A client can get a reference to an existing entity object's remote interface in any of the following ways:
* Receive the reference as a parameter in a method call. * By using a finder method defined in the entity bean's remote home interface. * By obtaining the reference from the entity object's handle.
My Doubt: --------- 1] Can Home Business method return an EJB Object reference?
2] Whether actual exam would have ambiguous questions like above.
Regards,<br />Sandesh<br />(SCJCP, SCWCD, SCBCD - 99%, OCP-1)<br /> <br />Either find a way or create one.