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

Doubts in Chapter-6 HF-EJB

 
Madhu SudhanV
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 6 - Entity Bean Synchronization - Mock Exam..

Ques 15 :
Which method(s) are always invoked in direct response to a client operation?

The choices are ejbLoad, ejbCreate, ejbremove, ejbActivate, ejbPassivate, setEntityContext..

The answers given in the book are : ejbCreate, ejbRemove..

But ejbActivate is called in response to a client operation..So shouldn't it be also an answer?Moreover, the comment given for that answer in that book says that Load, Passivate and setEntityContext can be called by the container when it wants it..Is it an errata in the book?

Ques 9 : Which method(s) from the EntityContext interface can be invoked from within the ejbCreate method?

The choices are : getEJBHome, getEJBObject, getCallerPrincipal, getUserTransaction, setRollbackOnly.

The answers given are : getEJBHome, getEJBObject, getCallerPrincipal, setRollbackOnly..But EJBOBject gets created only after ejbCreate method completes..So should the answer have getEJBObject??

In page no # 338, it says that "get a reference to your EJB Object" is not allowed in ejbCreate..Please clarify..
 
Jef Cumps
cowbird
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ques 15 :
ejbActivate is called when a client calls a business method, and ajbPassivate after the method returns. But I think the container is allowed to keep the bean activated after a business method. So then no passivation or activation happens between two business methods... The container can passivate and activate when he decides... Can anyone confirm this?


Ques 9 : Which method(s) from the EntityContext interface can be invoked from within the ejbCreate method?

getting a reference to your EJB Object is indeed not allowed in ejbCreate, seems like an error...
 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

On question :-

"Which method(s) are always invoked in direct response to a client operation?
The choices are ejbLoad, ejbCreate, ejbremove, ejbActivate, ejbPassivate, setEntityContext.."

Remember one thing ejbLoad,ejbActivate,ejbPassivate,setEntityContext are container callbacks methods and container can call anytime without client interaction means container is not dependent on client to call these method,depending on the container implementation,Container can call them.

And while ejbCreate,ejbRemove are only called by container when client invokes create and remove methods on remote interface.

I hope above explaination will help and Question 9 answer is wrong in the book,if u search in this forum only,you will find thread mentioning that.

Regards,

James
[ June 09, 2004: Message edited by: james edwin ]
 
Sree Nivas
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question No. 9 answer B is incorrect and it was corrected in the book authors errata page. Go thru the errata url given below.

http://www.oreilly.com/catalog/hfjejb/errata/

regards
Sree Nivas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic