An
EJB business method performs an operation that throws a checked exception. The bean cannot recover from this checked exception and should rollback. The bean will be deployed using container-managed transaction demarcation. Which implementation is the BEST?
a) public void businessMethod() { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { throw new EJBException(ae); } }
b) public void businessMethod() { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { context.setRollbackOnly(); throw new EJBException(ae); } }
c) public void businessMethod() throws EJBException { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { throw new EJBException(ae); } }
d) public void businessMethod() throws EJBException { try { // operation throwing SomeCheckedException goes here } catch (SomeCheckedException ae) { context.setRollbackOnly(); throw new EJBException(ae); } } }
Single Select - Please select the best answer (one and only one choice must be selected).