Re: Code Generation

From: Kevin J. Menard, Jr. (nirvdru..egativetwenty.net)
Date: Mon Dec 13 2004 - 20:15:04 EST

  • Next message: Andrus Adamchik: "Re: Code Generation"

    Hi Tore,

    On Dec 13, 2004, at 5:16 PM, Tore Halset wrote:

    > On Dec 13, 2004, at 16:14, Kevin J. Menard, Jr. wrote:
    >
    >> XMLDecoder decoder = new XMLDecoder();
    >> decoder.decode(xml);
    >> Test t = new Test(decoder);
    >
    > What if the found Test has the same primary key as another Test object
    > in the same DataContext? I think it would be easier if we have a
    > method returning the Test object based on the DataContext, the object
    > class and the xml.
    >
    > I am thinking about something like:
    > Test t = (Test)XMLDecoder.decode(dataContext, Test.class, xml);

    My "solution" to that is to not encode the primary key by default (you
    could do so with the mapping file, but then the assumption is that you
    know what you're doing). Thus, once you create t, you need to register
    it with a DataContext, and it gets inserted as a new row. This of
    course has the deficiency that all data import appends to database
    rather than allow existing entry modification. I don't know how
    important this is though. If it is, I can add it, but it seemed to me
    that would be more of a user logic task.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Mon Dec 13 2004 - 20:16:13 EST