Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFEJB Chap 6 Mock Exam Q9 p369

 
Pranav Shukla
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,


Which method(s) from the EntityContext interface be invoked from within the ejbCreate method? (Choose all that apply.)

A. getEJBHome()
B. getEJBObject()
C. getCallerPrincipal()
D. getUserTransaction()
E. setRollbackOnly()


Answer as per the mock exam solutions - A,B,C,E

I think getEJBObject() cannot be called from ejbCreate method because the EJBObject for 'this' bean instance is still not associated with it. It can only be used after entering ejbPostCreate().

So the correct statements should be A,C,E.

Please give your thoughts on this.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your assessment is confirmed by the EJB 2.0 specification.

Chapter 10 Entity Bean Component Contract for Container-Managed Persistence
10.5 Instance life cycle contract between the bean and the container
10.5.5 Operations allowed in the methods of the entity bean class
Page 179 - Table 4.

However you may want to invest some time in updating the information in your copy of HF EJB with the information found in the confirmed errata (that one is already covered). And if you find something else check the unconfirmed errata.
[ October 13, 2005: Message edited by: Peer Reynders ]
 
Pranav Shukla
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peer, for your reply and reference to the exact page number in EJB 2.0 specification!
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, in HFEJB the spec reference is right beside the solution (see HF EJB p. 369, Q9).
 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pranav

The confirmed errata list for HFEJB includes this question.

Errata
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic