Re: Queries on non-committed objects

From: Todd O'Bryan (toddobrya..ac.com)
Date: Mon Feb 06 2006 - 03:35:50 EST

  • Next message: Dave Merrin: "Query using foreign objects"

    That was, in fact, the problem.

    I have a Question class with a to-many relationship to QuestionDatum.
    When I created a datum, I was setting the question, but also calling
    addToData with the datum as an argument. Leaving one of those out
    cleared up the problem.

    Todd

    On Feb 5, 2006, at 8:19 PM, Cris Daniluk wrote:

    > I'm betting that he's calling addToData() AND setToData() on the
    > uncommitted object. I've noticed that when you set both forward and
    > reverse relationships, you get duplicates.. its pretty easy to
    > accidentally call both.
    >
    > On 2/5/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >>
    >> On Feb 5, 2006, at 6:15 PM, Todd O'Bryan wrote:
    >>
    >>> I tried to work around the problem by faking the query by going
    >>> through the elements I'd added to my DataObject by hand.
    >>> Unfortunately, it appears that things are getting double-added for
    >>> some reason. I'm using the Cayenne-generated addToData() method to
    >>> add 8 pieces of data to a DataObject. But when I called getData(),
    >>> I get a List with 16 elements. Similarly, when I go through the
    >>> List to pull out the elements I care about, I discover two exact
    >>> copies (down to oids) of the same object. Any idea what's going on?
    >>> None of this has been written to the database yet. Does Cayenne do
    >>> double-entry accounting for some reason?
    >>
    >> There have been earlier indications that a relationship list
    >> misbehaves under certain conditions. So I tend to think there might
    >> be a bug... Nothing I could reproduce though. So I would really
    >> appreciate if you (or someone else with a similar problem) submit a
    >> bug report with a DataMap and a self-contained test case showing the
    >> problem. Other than that, all I can say - it works for me :-)
    >>
    >> Andrus
    >>
    >>



    This archive was generated by hypermail 2.0.0 : Mon Feb 06 2006 - 03:36:10 EST