Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enthuware questions

 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following are true regarding a bean with bean managed transaction demarcation?

One of the options to this was
If it is a message-driven bean, it must commit a transaction (if it exists) before its message listener method returns.

The explaination given was
This is not fully true. A message driven bean may commit the transaction even in a timeout callback method.

Is this possible?


Secondly, there are loads of tiny details in this exam. Is the exam going to be this tough?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Core specification, 13.3.3 Enterprise Beans Using Bean-Managed Transaction Demarcation

A message-driven bean instance must commit a transaction before a message listener method or timeout callback method returns.
 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But does this mean that transaction was started in onMessage & commited in Timeout.??
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm not sure about that: the specs say that a stateful session bean may commit a started transaction before the business method returns.
Instead, for stateless session bean/mdb I suppose that it means that if I create a transaction in a business method, I have to commit before return.
The same is for timeout callback methods.

Finally, in 13.6.1, the specs say:

If a stateless session bean instance starts a transaction in a business method or interceptor method, it must commit the transaction before the business method (or all its interceptor methods) returns.


I hope this helps
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mmmhh, forget by previous "yes". Thinking about it twice, it does not seem possible. By the way, when a timeout happens in a MDB, in which transaction context will the timeout callback run ? Unspecified transaction context ?
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to what I remember, timeout callback transaction rules are the same as a business method, except for the fact that, in case of container managed transaction, it can be only REQUIRED, REQUIRES_NEW and NOT_SUPPORTED.
 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but the option to the question was so confusing. I hope the questions in the real exam are clear & crip!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic