Originally posted by Keerthi P:
Which are true about transactions in EJB 2.0 ?
A. ...
B. ...
C. ...
D. A bean instance can run multiple transactions in parallel.
E. A message-driven bean instance must complete a transaction before the 'onMesssage' method returns.
Correct Answer: E
I think D and E are the correct answers. Ofcourse, a stateful session bean instance cannot run multiple transactions in parallel(1 client -> 1 bean instance). But an entity bean instance can, because the same instance of an entity bean can be shared by two or more clients at the same time, which means there can be multiple transactions (initiated by each of the clients) running in the instance. Shouldn't the option D be more specific as to what the bean type is - session or entity?
Can someone please clarify?
[ February 10, 2005: Message edited by: Keerthi P ]
You cannot easily answer this question by reading HF-EJB. You need to read the ridiculously large (572 pages!) EJB 2.0 specification.
Assuning your analsis about session beans is correct (I believe it is), let's concentrate on entity beans. On page 187 of the spec, at the bottom, the answer is potentially given.
...
"The container activates multiple instances of the entity bean, one for each transaction in which the entity object is being accessed."
...
This statement implies multiple entity bean instances for each transaction started. By implication, one transaction can be run per bean.
I'd hate to take the above quote out of context, but I do believe this is the justification for E. being the only correct answer to the question.
-jeff walker
(This brings up my point from previous posts, that HF-EJB is not sufficient to answer the deep questions about EJB, like this one. It is a good book to pass the exam, but not to score high in the exam).