Friday, 27 January 2012

Create separate WebSphere Commerce transaction


Option 1:
try{
  TransactionManager.begin();
}catch (Exception e){
 LOGGER.log(WsLevel.FATAL, "Failed to start a new transaction");
 LOGGER.log(WsLevel.FATAL, "Exception caused by " + e.getMessage(), e);
}
//TODO Execute your commands
try{
  TransactionManager.commit();
}catch (Exception e){
 LOGGER.log(WsLevel.FATAL, "Failed to commit transaction");
 LOGGER.log(WsLevel.FATAL, "Exception caused by " + e.getMessage(), e);
}

Option 2:
try{
  TransactionManager.begin();
  //TODO Execute your commands
  TransactionManager.commit();
}catch (Exception e){
 LOGGER.log(WsLevel.FATAL, "Failed to execute job");
 LOGGER.log(WsLevel.FATAL, "Exception caused by " + e.getMessage(), e);
}

No comments:

Post a Comment