Oracle
1Z0-860 · Question #169
A developer is working on a user registration application using EJB 3.0. A business method registerUser in stateless session bean RegistrationBean performs the user registration. The registerUser…
The correct answer is D. Create an application exception with the rollback attribute set to false and have register User method. See the full explanation below for the reasoning.
Question
A developer is working on a user registration application using EJB 3.0. A business method registerUser in stateless session bean RegistrationBean performs the user registration. The registerUser method executes in a transaction context started by the client. If some invalid user data causes the registration to fail, the client invokes registerUser again with corrected data using the same transaction. Which design can meet this requirement?
Options
- AHave registerUser method call EJBContext.setRollbackOnlyO method after registration fails.
- BHave registerUser method throw javax.ejb.EJBTransactionRequiredException after registration fails.
- CHave registerUser method throw EJBException without marking the transaction for rollback, after
- DCreate an application exception with the rollback attribute set to false and have register User method
How the community answered
(56 responses)- A2% (1)
- B9% (5)
- C5% (3)
- D84% (47)
Community Discussion
No community discussion yet for this question.