Re: Stored procedure execution order

From: Cris Daniluk (cris.danilu..mail.com)
Date: Fri Jul 22 2005 - 09:17:15 EDT

  • Next message: Dhruti Ramani: "SQLException in M to M relation"

    Thanks. I'll let you know if anything special is required.

    On 7/22/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > 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 - 09:17:22 EDT