Return-Path: Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: (qmail 11083 invoked from network); 10 May 2010 15:51:13 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 May 2010 15:51:13 -0000 Received: (qmail 37220 invoked by uid 500); 10 May 2010 15:51:13 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 37166 invoked by uid 500); 10 May 2010 15:51:12 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 37158 invoked by uid 99); 10 May 2010 15:51:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 May 2010 15:51:12 +0000 X-ASF-Spam-Status: No, hits=-0.2 required=10.0 tests=AWL,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.161.43] (HELO mail-fx0-f43.google.com) (209.85.161.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 May 2010 15:51:06 +0000 Received: by fxm14 with SMTP id 14so2329403fxm.16 for ; Mon, 10 May 2010 08:50:44 -0700 (PDT) Received: by 10.204.141.133 with SMTP id m5mr2571040bku.91.1273506644221; Mon, 10 May 2010 08:50:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.112.144 with HTTP; Mon, 10 May 2010 08:50:24 -0700 (PDT) From: Michael Gentry Date: Mon, 10 May 2010 11:50:24 -0400 Message-ID: Subject: Deletes before Inserts? To: Cayenne Developers Content-Type: text/plain; charset=ISO-8859-1 Is there a reason why INSERTs occur before DELETEs? It looks like this is the bit of code that orders it (at least in 3.0): DataDomainFlushAction.java / preprocess insertBucket.appendQueries(queries); flattenedBucket.appendInserts(queries); updateBucket.appendQueries(queries); flattenedBucket.appendDeletes(queries); deleteBucket.appendQueries(queries); There seems to be an issue if you have a DB constraint (unique column, for example). Say the "key" column needs to be unique and you delete the record with key="timeout" and insert another new record with key="timeout". The commit will fail because the insert occurs before the delete. Thanks, mrg