Automatically managing last_modif_date and modified_by columns

From: Thomas Gilbert (thomas.gilber..ide-international.com)
Date: Fri Jun 22 2007 - 05:41:51 EDT

  • Next message: Aristedes Maniatis: "Re: Automatically managing last_modif_date and modified_by columns"

    Dear all,

    Using Cayenne (2.0) I'm trying to put in place the following mechanism:

    Example:

    Table ScmsCase columns (example) :

    id
    blabla
    creation_date
    last_modif_date
    modified_by

    I would like to automatically change de last_modif_date and modified_by
    columns whenever an update is done on a records (e.g. when setBlabla()
    is called).
    I already tried to use DataContextDelegate like this

    public boolean shouldMergeChanges(DataObject object, DataRow
    snapshotInStore)
    {
                if (object instanceof ScmsCase)
                {
                    ((ScmsCase)object).setLastModificationDate(new Date());
                    ((ScmsCase)object).setModifiedBy(m_szUserID);
                }
                return true;
    }

    The hook is called when needed but the changes does not seem to be
    committed. Also note that finishedMergeChanges is not triggered.

    Is it the right way to achieve this ? Are they other ways ?

    Thanks a lot

    Thomas

    ------------------------------------------------------------------
    CONFIDENTIALITY: This e-mail and any files transmitted with it are confidential and intended solely for the use of the recipient(s) only. Any review, retransmission, dissemination or other use of, or taking any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you have received this e-mail in error please notify the sender immediately and destroy the material whether stored on a computer or otherwise.

    DISCLAIMER: Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of SIDE International S.A. - EastNets Group, unless otherwise specifically stated.
    ------------------------------------------------------------------



    This archive was generated by hypermail 2.0.0 : Fri Jun 22 2007 - 05:42:18 EDT