Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question from a Mock test

 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Severin Stoeckli
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
] Can Home Business method return an EJB Object reference?

Why not?

spec 10.6.6:

If the ejbHome<METHOD>(...) method corresponds to a home <METHOD>(...) on the entity
bean�s remote home interface, the method argument and return value types must be legal types for
RMI-IIOP.


Severin
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question from a Mock test

Which mock test is that?

PS: Mock exam authors like to get some credit for their hard work
 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Valentin,

Sorry for replying late.

Question was from Mock test of ejbcertificate.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic