nerdexam
Oracle

1Z0-860 · Question #113

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 register User method call EJBContext.setRollbackOnly method after registration fails.
  • BHave register User method throw javax.ejb.EJBTransactionRequiredException after registration fails.
  • CHave register User 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

(51 responses)
  • A
    18% (9)
  • B
    4% (2)
  • C
    8% (4)
  • D
    71% (36)

Community Discussion

No community discussion yet for this question.

Full 1Z0-860 Practice