• Post Reply Bookmark Topic Watch Topic
  • New Topic

HFEJB doubt in Question (EntityBean's ejbCreate() )

 
nitin goswami
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
Please clarify one doubt:
HFEJB - Page:364 Q#9
--------------------
Which Method(s)from ENtityContext interface can be invoked from whitin the ejbCreate method?(Choose all that apply)
A. getEJBHome ()
B. getEJBObject () --------------> doubt here.
C. getCallerPrincipal ()
D. getUserTransaction ()
E. setRollBackOnly ()

ANS. A. B. C. E.

Doubt: Can we call getEJBObject () from ejbCreate() ? As per my understanding and the page no. 338, EJBObject gets created after ejbCreate() and after the database insert. ejbPostCreate () can no doubt get the reference of EJBObject.

I would be thankful if somebody can clarify this doubt as I am going to take the exam very soon.
 
Arun Kandregula
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right.
B cannot be the answer.
We cannot call getEJBObject() in ejbCreate() of entity bean.
 
Joy Mookerji
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Absolutely write its only in ejbPostCreate() that yu can call getEJBObject() not in ejbCreate() The purpose of the ejbPostCreate() is to create a EJBObject and stamp the primary key to the EJBObject and the EntityContext.
I will suggest referring to Paul Sanghera too
 
cheenu Dev
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
better guys see the errata.
you will know whats the printing mistakes.
it is here
in my opinion head first is way too good than mannings.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!