Re: PermIds and the new ContextCommit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Mar 13 2003 - 01:05:28 EST

  • Next message: Andriy Shapochka: "Re: PermIds and the new ContextCommit"

    Just refactored PKGSupport to util.PKHelper. But the main change is
    that now it belongs to DataDomain, and is shared between the contexts.
    I think this makes quiet a lot of sense (and addresses Arndt's concerns
    about performance. I plan to refactor this further, switching it to use
    DefaultSorter for entity sorting, to avoid duplicating the sorting
    algorithm. Hope both algorithms work the same way.

    Craig, sorry this will break your uncommitted patch. You will need to
    move it over manually.

    As for public API to create ObjectId, it can be implemented either on
    DataContext or DataDomain level. I suggest do the actual work in
    PrimaryKeyHelper, but use a wrapper method in Data[Context|Domain]
    calling it, since though PKHelper is public now, we wouldn't want to
    expose it more than needed. I am planning to write this code in a few
    days, unless somebody does it sooner.

    ;)

    Andrus

    On Tuesday, March 11, 2003, at 04:56 PM, Craig Miskell wrote:

    > On Wed, 2003-03-12 at 10:53, Andriy Shapochka wrote:
    >>
    >>> to have in DataContext? The code is nearly identical (the PKGSupport
    >>> method appears slightly more complex... probably good reason :-)),
    >>> and
    >>> createPermId is only used by a couple of tests.
    >>>
    >>> Should createPermId be deprecated and implemented in terms of
    >>> PKGSupport.createPermIdsForObjEntity() ?
    >>>
    >>> Craig
    >>>
    >>
    >> Maybe, we should remove the method from DataContext altogether. Are
    >> there
    >> any realistic scenarios when a Cayenne user can desire to create
    >> primary ids
    >> manually with DataContext.createPermId(...)? It looks very internal
    >> thing to
    >> me.
    > Well, like I said, we use it. We simply need to ensure that the object
    > *has* a permanent id, so perhaps "create" is a misnomer. I definitely
    > think there needs to some public API (as per comments by Andrus), but
    > just what that should be may lead to interesting debate! :-)
    >
    > Some ideas (not fully formed, will probably have flaws):
    > 1) Method on TempObjectId to ensure creation of perm id.
    > 2) Method on DataContext which does the same sort of thing, but takes
    > an
    > object as the argument.
    > 3)... other?
    >
    > 2 seems reasonable... checks the objectid of the object. If a
    > permanent
    > id is needed, uses PKGSupport to get it. Should work :-)
    >
    > Craig
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Mar 13 2003 - 01:08:59 EST