FAQ
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.

Search Discussions

  • Mike Kienenberger at Mar 9, 2012 at 2:36 pm
    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.
  • Atomix at Mar 21, 2012 at 1:33 am
    @Mike , thanks a ton! Really appreciate!

    I take your suggestion ... the reason I didn't take it sooner because I
    don't want to change the structrure of the orginal tables.

    After some changes, they all work fine!

    --
    View this message in context: http://cayenne.195.n3.nabble.com/HELP-Problem-Cayenne-ORM-and-TEMP-tables-tp3811483p3844305.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedMar 9, '12 at 1:58a
activeMar 21, '12 at 1:33a
posts3
users2
websitecayenne.apache.org

2 users in discussion

Atomix: 2 posts Mike Kienenberger: 1 post

People

Translate

site design / logo © 2023 Grokbase