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?
a. Have registerUser method call EJBContext.setRollbackOnly() method after registration fails.
b. Have registerUser method throw javax.ejb.EJBTransactionRequiredException after registration fails.
c. Have registerUser method throw EJBException without marking the transaction for rollback, after registration fails.
d. Create an application exception with the rollback attribute set to false and have registerUser method throw it after registration fails.
Answer: D
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.