Sunday, 16 September 2012

How the ATG Order flow manages a transaction

See more about ATG  Tx management @

Most of the ATG Commerce form handlers extend atg.commerce.order.purchase.PurchaseProcessFormHandler. The transaction management pattern in order flow is implemented through this form handler’s beforeSet, afterSet, and handler methods.

The transaction will be started @ beforeSet method and is ended @ afterSet method.

In general, the design pattern for updating an order is as follows:
  1. Acquire lock-manager write lock on profile id from the /atg/commerce/order/LocalLockManager
  2. Begin Transaction
  3. Synchronize on the Order object.
  4. Modify Order
  5. Call ((OrderImpl) pOrder).updateVersion(); --> atg.commerce.order.InvalidVersionException is thrown based on this
  6. Call OrderManager.updateOrder()
  7. Release Order synchronization
  8. End Transaction
  9. Release lock-manager write lock on profile id from the /atg/commerce/order/LocalLockManager
       If you extend atg.commerce.order.purchase.PurchaseProcessFormHander, then steps 1,2,8 & 9 are done for you in the beforeSet and afterSet method implementations. Steps 3&7 are no longer strictly necessary, but are still good practice. Steps 3-7 should be performed manually in your application code.

Find below the screen shot of ATG doc with this details :

Find more info @

No comments:

Post a Comment