Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F6D0952E for ; Fri, 9 Mar 2012 14:36:41 +0000 (UTC) Received: (qmail 96979 invoked by uid 500); 9 Mar 2012 14:36:40 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 96951 invoked by uid 500); 9 Mar 2012 14:36:40 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 96943 invoked by uid 99); 9 Mar 2012 14:36:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2012 14:36:40 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mkienenb@gmail.com designates 74.125.82.41 as permitted sender) Received: from [74.125.82.41] (HELO mail-ww0-f41.google.com) (74.125.82.41) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Mar 2012 14:36:35 +0000 Received: by wgbds1 with SMTP id ds1so706468wgb.4 for ; Fri, 09 Mar 2012 06:36:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=isjd2wqIeeoUcHTbl29nzb9p4mkOyGQvKYiq6lxQOiY=; b=uOY5yvZlgeDyfvXAgpJKa7106kux6kgeQzN+YEmfvzsRzD5DJRkK8mqXN8cs/qicQ2 +VQ04+0qknxqsVQ8+t9VJ/zz8o1uNVFpPQZ0OTFijeY73X43a14Bwz9KztwH215VbDx6 /y+l1C6Hn64NfklUvBxVPjJKx5dlXgxjRqtKHVU78QQEHvA5gIcwuo4fBnKXqYrpPtN2 jN+9nfX9eoaP8YSLR3UrBGFsHJhBicLWdgRFFE48l99TMs4njDxBZGhJHHXh7cNaTE0k 7Vcuh3VMwteaHGTXvEhntKosbHrrrbVGmLHnY+nFHkgBhzv6Byxu6scYOKSXM6GElx/h jI6g== Received: by 10.216.134.83 with SMTP id r61mr1671259wei.17.1331303774249; Fri, 09 Mar 2012 06:36:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.105.166 with HTTP; Fri, 9 Mar 2012 06:35:53 -0800 (PST) In-Reply-To: <1331258298133-3811483.post@n3.nabble.com> References: <1331258298133-3811483.post@n3.nabble.com> From: Mike Kienenberger Date: Fri, 9 Mar 2012 09:35:53 -0500 Message-ID: Subject: Re: [HELP] Problem: Cayenne - ORM and "TEMP" tables To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org If it were me, I would add a status column to the Test table (approved, pending-approval, maybe rejected). Then I would store both approved tests and pending-approval tests in the same tables rather than using identical temporary tables. You might also consider adding a related_parent_test_id column to the Test table, so you can quickly identify which tests are related revisions of each other. When a Maker makes a change to a test, make a new pending-approval copy of the Test, linking it back to the original. When an Approver approves it, delete the original (or mark it as obsolete) and mark the new test as approved. When an approver rejects it, delete the copy (or mark it as rejected). Another approach would be to add the status column to each table. Instead of copying the entire test, just maintain the differences between the approved test records and the pending-approval test records. Possibly you'd use status items like (pending-addition, pending-removal, pending-modification). Then you don't need to maintain and copy entire tests. But in any case, I would avoid separate identical tables. On Thu, Mar 8, 2012 at 8:58 PM, atomix wrote: > I had a situation, not completely related to Cayenne only, may be every ORM > framework... > > Say I had a Test, the Test has Question(s) ,a Question can be in various > Test > Test -n-n- Question for short. > Also, in TestHasQuestion table has a property of order, and value of the > Question in a specific the Test. > > Here is the problem: > The every update in a Test have to be approved (by Maker and Approver) > > So basicly, a Maker do a lot of changes in a Test, then submit it in a Temp > Table (which have almost same structure), then Approver accept or reject, > the Test should be return to its previous APPROVED status. > --------------------------------------------------------- > Yes, the scenerio for 1 Table is pretty simple to imagine... > Now, Question also -1-n- to Answers. Answers also link to another Table.. > ... > and I confused a lot how to work out the case in a ORM system like Cayenne. > It can be handle in a simpler enviroment like SQL, but the whole tables are > linked together in Cayenne... > > Just few temp-tables make my life suck big times .... > ... > > -- > View this message in context: http://cayenne.195.n3.nabble.com/HELP-Problem-Cayenne-ORM-and-TEMP-tables-tp3811483p3811483.html > Sent from the Cayenne - User mailing list archive at Nabble.com.