Re: Foreign key constraint problem.

From: Aristedes Maniatis (ar..aniatis.org)
Date: Wed Jun 17 2009 - 19:38:39 EDT

  • Next message: Malcolm Edgar: "Re: Cayenne Fetch Limit behaviour ?"

    On 18/6/09 7:51 AM, Michael Shea wrote:
    > It looks to me like Cayenne is attempting to insert the new row before
    > deleting the old one; I notice that in DataNode.performQueries, the
    > collection of queries contains 3 queries: An InsertBatchQuery, an
    > UpdateBatchQuery and a DeleteBatchQuery. Looks like the insert and
    > update are being run before the delete to me, although I haven't looked
    > too deeply into this code to try to figure out what's going on.

    You can turn debugging on and see the SQL statements being generated by Cayenne to verify what is happening. But my guess is that since the entire operation is in one transaction, MySQL is performing constraint checks before committing that transaction.

    Perhaps you should consider using a non-meaningful generated primary key, or just altering the record rather than deleting and recreating it.

    Ari Maniatis



    This archive was generated by hypermail 2.0.0 : Wed Jun 17 2009 - 19:39:27 EDT