• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFEJB Page 371, Q# 18

 
Aatir Ahmed
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I am totally lost on this question.

Question asks which methods run in the tx ctx of caller method
1. ejbLoad
2. ejbRemove
3. ejbSelect
4. ejbActivate
5. ejbPassivate
6. setEntityContext

To my understanding all of 6 options are correct but books says only 1, 2 and 3 are correct.

Can anybody help me?
 
Hai Lin
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aatir,
I think the book's answer is correct.
Because as for ejbActivate(), ejbPassivate(), setEntityContext(), whithin this three methods there's no valid Tranaction context. Please take a look spec Page 80 (for stateful Session Bean), Page 180 (for Entity Bean), since no valid tx ctx within these methods, of course 4, 5, 6 are wrong, while in the 1, 2, 3 methods, valid tx ctx are there.
since MessageDriven Bean and stateless bean has no ejbActivate(), ejbPassivate(), so we don't need to concern this two types of bean here.

Hope it can help you.

Hai
 
Aatir Ahmed
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Lin for your help. Your help is greatly appreciated.
 
Dan T
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was wondering why ejbRemove() is correct?

in spec page 79, it says "The ejbRemove() method cannot be called when the instance is participating in a transaction. An attempt to remove a session object while the object is still in a transaction will cause the container to throw the javax.ejb.RemoveExcetption to the client."

The original question was: Which method(s) run in the transaction context of the method that causes their invocation?

(maybe i understand question wrong?)

**hmm.. or is it talking about Entity beans only
[ August 01, 2004: Message edited by: Ryan Wong ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic