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

Hard ICE question

 
marco ves
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question is hard. Can anyone help?
The following sequence of method calls occurred on a CMP entity bean instance when a session bean invoked the CMP's businessMethod1() and businessMethod2() methods from the same session bean method entityBean.ejbActivate() entityBean.ejbLoad() entityBean.businessMethod1() entityBean.businessMethod2() entityBean.ejbStore() entityBean.ejbPassivate() Assuming that the session bean is configured with 'Required', what MUST be TRUE about the scenario that generated these method calls?
A.The business methods are NOT configured with 'RequiresNew'
B.Any persistent state changes that occur as a result of businessMethod1() are in the same transaction scope as changes made by businessMethod2().
C.Any persistent state changes that occur as a result of businessMethod1() are in a different transaction scope than changes made by businessMethod2().
D.ejbStore() will write the resultant state of the entity bean to the persistent store.
Select 2 answers.
Is the answer B and D ?
 
Manish Sarlashkar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Mark,
I am trying to answer your question, please correct me if I am wrong.
The answer to the question is, 'a' and 'b'.
The reasons are,
Why D is an incorrect choice,
1. The entity bean is a CMP entity bean.
2. For CMP bean, the container handles the persistance of the data and ejbStore()(and also ejbLoad()) method/s are called by container (callback methods) to give the developer , some chance to do some work before persisting or after reading the data.
3. The life cycle events will be(considering the question),
entityBean.ejbActivate()---> entityBean.ejbLoad()---> entityBean.businessMethod1()---> entityBean.businessMethod2()----> entityBean.ejbStore()---> and then(container will extract the persistant fields from bean instance and will write to DB) ----> entityBean.ejbPassivate()
If the entity bean is a BMP, then answer 'D' is correct.
Why 'a' is a correct choice,
1. If the business methods were marked with 'RequiresNew' Tx attribute, the container would have started a new transaction for each business method while suspending the client's(the session bean's transaction); and what has mentioned in option 'c' would have happened.
So the business methods are not marked with 'RequiresNew' Tx attribute and hence 'a' is true.
Thanks,
Manish
 
marco ves
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you are correct. Thank you for the reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic