Go back to 1Z0-895 - Java Platform, Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Exam

Question :-

A developer implements a CMT session bean with a method storeBoth which inserts data both a related database and an LDAP server. The relational database supports transactions while the LDAP system does NOT. Given that both updates should succeed or be rolled back, while is the best solution?
Implement the SessionSynchoronization interface in the session bean. In the afterCompleteion method, the LDAP inserts are rolled back if false is passed as an argument to the afterCompletion method.
Define the transaction attribute of the method storeBoth as REQUIRED. The container manages the transactions and will roll back modifications if something goes wrong in either database insert or LDAP insert.
Define the transaction attribute of the method storeBoth as REQUIRED_NEW. Carry out the database insert first. Subsequently, execute the LDAP inserts, catching LDAP exceptions. If exceptions are raised, call the SessionContext.setRollBackOnly method.
Define the transaction attribute of the method storeBoth as REQUIRED_NEW. Carry out the LDAP insert first. If SessionContext.getRollBackOnly returns false, execute the database inserts, catching SQL exceptions. If exceptions are raised, call the SessionContext.setRollBackOnly.

Want to practice for 1Z0-895 - Java Platform, Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Exam ? Click here.