Design Pattern for Updating an ATG Order

///Design Pattern for Updating an ATG Order

Design Pattern for Updating an ATG Order

This is from a post Jeremy Sears made here on the ATG_Tech Google Group, but I thought it was nice and clear and worth reposting. All credit to Jeremy for this:

“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();
  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. Calling step 6 within the transaction is mandatory and the lock manager work should always wrap the transaction to prevent some rare transaction race conditions. “

By |2007-10-22T14:16:12+00:00October 22nd, 2007|ATG|7 Comments

About the Author:

Devon is a husband, amateur photographer, avid reader, and motorcycle enthusiast.


  1. Tijomon Mathew January 10, 2011 at 3:48 am - Reply

    What is the significance of Synchronize on the order ? if we check the cartformhandler it is a request scope but still why

    Synchronize on order is done ?

    • gffhgffhg April 21, 2015 at 6:44 am - Reply

      cartformhandler is request scoped but order resides in shopping cart which is A session scoped component. synchronize is make sure other processes dont have access to order object from the current session.

  2. Nick Glover March 5, 2012 at 9:34 am - Reply

    The wording on this is a bit out-of-date. See for the latest article on this. It does require Oracle support access to view.

    • Devon March 5, 2012 at 9:40 am - Reply

      Thanks Nick! Too bad it’s behind a paywall most individual devs may not have access to though. Any chance it can be made public? Or I can repost it here?

      • Nick Glover March 5, 2012 at 1:01 pm - Reply

        Hi Devon,

        Sorry, Oracle knowledge content cannot be made public, nor can it be re-posted.


        Nick Glover
        Oracle Support for ATG Products

  3. Deezer February 11, 2013 at 8:23 am - Reply

    Calling updateVersion is a bit dangerous unless there is other preventions in place to prevent multiple sessions at the same time . It’s saying, forget everything and consider this copy of the order as the master, and then persist.

  4. Heidar February 11, 2013 at 1:05 pm - Reply

    what if i did the lock on the orderID ? instead of profileid

Leave A Comment