Re: Code Generation

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Dec 13 2004 - 20:32:26 EST

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

    See my other message on this topic
    (http://objectstyle.org/cayenne/lists/cayenne-devel/2004/12/0041.html).
    I hope this is more or less accurate analysis. This is completely in
    line with what Kevin is saying here.

    Andrus

    On Dec 13, 2004, at 8:15 PM, Kevin J. Menard, Jr. wrote:

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



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