import javax.transaction.*;
public class TransactionExample {
private UserDAO userDAO;
public void updateUser(User user) throws SystemException, NotSupportedException, HeuristicRollbackException, HeuristicMixedException, RollbackException {
try {
UserTransaction tx = getTransactionManager();
tx.begin();
userDAO.update(user);
tx.commit();
} catch (Exception e) {
tx.rollback();
}
}
private UserTransaction getTransactionManager() {
}
}