GeeCON Prague 2014*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Wrong Enthuware Answer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Wrong Enthuware Answer" Watch "Wrong Enthuware Answer" New topic
Author

Wrong Enthuware Answer

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Which of the following are true regarding a bean with bean managed transaction demarcation?

1) The bean must be a session bean or a message-driven bean.

2) The bean instance that starts a transaction must complete the transaction before it starts a new transaction.

3) The bean may use nested transactions.

4) If it is a a stateless session bean, it must commit a transaction before a business method or timeout callback method returns.

5) If it is a message-driven bean, it must commit a transaction (if it exists) before its message listener method returns.

Explanation- This is not fully true. A message driven bean may commit the transaction even in a timeout callback method.

the correct answer is 1,2 and 4.

the 2nd answer is absolutely wrong, because that statement is not fully true. SFSB's may not commit a trsansaction before they start a new transaction.


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Chandrashekhar Raiphale
Greenhorn

Joined: Aug 26, 2006
Posts: 14
Hi, Please read on page no 325 of core-specification. It says

"An instance that starts a transaction must complete the transaction before it starts a new transaction."

"A stateful session bean instance may, but is not required to, commit a started transaction before a business
method returns.
If a transaction has not been completed by the end of a business method, the container
retains the association between the transaction and the instance across multiple client calls until
the instance eventually completes the transaction."


Read on page no 343 of core-specification. It says

"When an instance attempts to start a transaction using the begin method of the javax.transaction.
UserTransaction interface while the instance has not committed the previous transaction,
the container must throw the javax.transaction.NotSupportedException in the begin
method."


Cheers,<br />Chandrashekhar <br />SCJP
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Please read it carefully-

Answer says-

2) The bean instance that starts a transaction must complete the transaction before it starts a new transaction.


And specification says-

A stateful session bean instance may, but is not required to , commit a started transaction before a business
method returns.
Chandrashekhar Raiphale
Greenhorn

Joined: Aug 26, 2006
Posts: 14
yes, that is alos correct.

see "Table 12 Container’s Actions for Methods of Beans with Bean-Managed Transaction".

If the transaction associated with the instance is T1, then business called will be execuated in same transaction.

There will not be new transaction, if you tried to create one, you will get javax.transaction.NotSupportedException in the begin
method.



following lines from MK's study guide

"A stateful session bean instance may, but is NOT REQUIRED to, commit a started transaction before a business method returns. If a transaction has not been completed by the end of a business method, the container retains the association between the transaction and the instance across multiple client calls until the instance eventually completes the transaction. "
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
i think this should also be fixed. Please verify.
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3308
    
    7
Amandeep Singh wrote:i think this should also be fixed. Please verify.


Hello, As mentioned by Chandrashekhar, a bean is not allowed to start a new transaction before the existing transaction ends (the existing transaction may end in the same method call or it may span accross multiple method calls in case of SFSBs). So the given answer is correct and does not need any fix


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
 
GeeCON Prague 2014
 
subject: Wrong Enthuware Answer