Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

HFEJB Page 371, Q# 18

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Lin for your help. Your help is greatly appreciated.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
I can't take it! You are too smart for me! Here is the tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic