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

EJB Clarifications

 
Cheers Prasad
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi SCEAs
I have doubt in certain questions and need clarifications for certain questions mentioned in one of the mock test
1. In EJBs, Which two callback methods can be used for synchronizing the bean's state with the database
 a. ejbStore() and ejbLoad()
 b. ejbActivate() and ejbPassivate()
 c. ejbStore() and ejbPasivate()
 d. ejbLoad() and ejbActivate()
Given answer is b) but i think answer should be a) --Please need clarification.
2. When does an Entity Bean transition from Pooled State to Ready state
 a. when create() is invoked on EJBHome
 b. when a find method is invoked on EJBHome
 c. when a BEan is activated by the container
 d. when a BEan is passivated by the container
Given Answers are a), b), c)
My comment:- Invoking find method does not move the EJB pooled state to ready state . Answer c is wrong . Snippet from EJB 2.0 Specs
"The instance does not move to the ready state during the execution of a finder or a home method".
3. When is ejbStore() invoked?
 a. Immediately before the container reads the Bean's state information.
 b. Immediately after the containter reads the BEan's state information
Given Answer is a)
4. When is ejbLoad() invoked?
 a. Immediately before setting the Bean's state information.
 b. Immediately after setting the Bean's state information
Given Answer is b
Can any one give explanation for questions 3 and 4
 
Alessandro Martins
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I myself went into doubt, and I went to check it out in Ed Roman's book; ejbLoad and ejbStore are both callbacks (as ejbActivate and ejbPassivate also are) that are called, respectivelly, after and before the cited methods in parenthesis (first act, then load and first pass, then store) by the container itself, so you are completely right.
About the third and fourth questions, the given answers are the wrong ones too. And about the second one... the specs don't lie :-).
What mock exam was that?
Thanx,
Alessandro Martins
No certs, only battle scars :-)
 
D. Rose
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. In EJBs, Which two callback methods can be used for synchronizing the bean's state with the database
 a. ejbStore() and ejbLoad()
 b. ejbActivate() and ejbPassivate()
 c. ejbStore() and ejbPasivate()
 d. ejbLoad() and ejbActivate()
Given answer is b) but i think answer should be a) --Please need clarification.

I think answer a is correct.

2. When does an Entity Bean transition from Pooled State to Ready state
 a. when create() is invoked on EJBHome
 b. when a find method is invoked on EJBHome
 c. when a BEan is activated by the container
 d. when a BEan is passivated by the container
Given Answers are a), b), c)

Monson-Haefel book states the following abouth this
In Many cases ( depending on EJB vendor) ,found entity beans don't actually migrate into ready state until they are accessed by client. Resources are saved by activating entity beans lazily.

So I think b is not the correct answer.
3. When is ejbStore() invoked?
 a. Immediately before the container reads the Bean's state information.
 b. Immediately after the containter reads the BEan's state information
Given Answer is a)

ejbStore is called just before container synchronizes database with bean data so answer a would only make sense if it says 'writes' instead of 'reads'.

4. When is ejbLoad() invoked?
 a. Immediately before setting the Bean's state information.
 b. Immediately after setting the Bean's state information
Given Answer is b

I think answer is correct because ejbLoad will be called after ejbActivate which where container sets bean's state info( not wrt session but info so as to make bean method ready).
Overall, it would be retty confusing if such reeoneous questions appear in real exam!
[ March 04, 2004: Message edited by: Rei Damle ]
 
Cheers Prasad
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys,
These mock questions are given by one of our javaranch members in one of the link.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic