Re: Stored procedure execution order

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Jul 22 2005 - 07:11:35 EDT

  • Next message: Andrus Adamchik: "M5 is out"

    Chris,

    Register a shared TransactionDelegate
    (DataDomain.setTransactionDelegate(..)). The delegate will run a
    stored procedure inside "willCommit(..)".

    http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
    access/TransactionDelegate.html

    I never tried running a query from willCommit myself, so I am not
    sure if you need to do anything special. One common sense advice -
    use the same transaction as the one that initiated willCommit(..).
    This means that you will need to call a 3-argument version of
    performQueries - "performQueries
    (Collection,OperationObserver,Transaction)" - on a DataContext or a
    DataDomain.

    Andrus

    On Jul 21, 2005, at 11:13 PM, Cris Daniluk wrote:

    > I'm having a little trouble figuring out how to control the execution
    > order of stored procedures. I have a procedure that replicates a
    > changed record out to various locations that I need to have executed
    > after a series of changes to that record are written by Cayenne. The
    > problem I'm having is that the INSERT/UPDATE calls are not made by
    > Cayenne until I invoke commitChanges(), but that (cleverly) commits
    > the transaction as well. If my stored proc fails, I can't roll back
    > past this.
    >
    > Basically, I need to register the stored procedure to run after all of
    > the inserts/updates have been performed, but before the transaction is
    > committed. Is there a good way to do this?
    >
    > Thanks,
    >
    > Cris
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Jul 22 2005 - 07:11:39 EDT