[Solved]: targetObject.getObjectId().getIdSnapshot() returns non-primary key attributes

From: Mike Kienenberger (mkienen..laska.net)
Date: Wed Mar 03 2004 - 16:59:06 EST

  • Next message: Mike Kienenberger: "Bug in ObjEntity 1.1M3 setDataMap?"

    > On Mar 2, 2004, at 2:06 PM, Mike Kienenberger wrote:
    > > Am I wrong in thinking getIdSnapshot() would only return fields marked
    primary
    > > keys?

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    > ObjectId snapshot should only contain PK values. If you find evidence
    > to the opposite, please file a bug report with details.

    I didn't see the behavior under 1.1M3 without my mods.

    I did more testing and eventually found the problem in
    ContextCommit.prepareUpdateQueries() which takes the generated idSnapshot
    and resets the dataobject with the value. Since I was generating an
    idSnapshot Map that included the locking attributes, this was then being
    passed on to the dataobject. I'm changing my code so that it only uses the
    new Map in the UpdateQuery and uses the original idSnapshot in the following
    code.

                        if (isMasterDbEntity) {
                            ObjectId updId =
                                updatedId(
                                    o.getObjectId().getObjClass(),
                                    idSnapshot,
                                    snapshot);
                            if (updId != null) {
                                o.getObjectId().setReplacementId(updId);
                            }

                            updObjects.add(o);
                        }



    This archive was generated by hypermail 2.0.0 : Wed Mar 03 2004 - 16:58:05 EST