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.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.



Leave a Reply 0

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