Which design can meet this requirement?

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 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.setRollbackOnlyOmethodafter registration fails.

B.
Have registerUser method throw javax.ejb.EJBTransactionRequiredExceptionafterregistration
fails.

C.
HaveregisterUser method throw EJBException without marking the transaction for rollback,
after registration fails.

D.
Create an application exception withtherollbackattributeset to falseandhave registerUser
method throwit afterregistration fails.



Leave a Reply 0

Your email address will not be published. Required fields are marked *