Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Hard ICE question

 
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 ?
 
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.
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!