Re: Newbie help with error on commit. Possible relationship error?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Oct 13 2004 - 08:59:51 EDT

  • Next message: Andrus Adamchik: "RE: More Detail: NullPointerException in call to DataContext.crea teDataContext()"

    Hi Gowry,

    You are right - house record shouldn't be touched in this case. And to the
    best of my knowledge Cayenne handles suc cases pretty well. Could you post
    a DataMap XML file (or send it to me directly) - I'll try to reproduce the
    problem (hopefully tonight). Also what version of Cayenne are you using?

    Thanks
    Andrus

    > Hi,
    >
    > I'm trying to get my application to work and currently I get
    > an exception when trying to commit to the database. I have
    > several places where I remove or re-parent an item from a to-many
    > relationship. I tried to find more information on the website but
    > this section is mostly tbd.
    >
    > the table is something like:
    >
    > table counter
    > column bird_id int PK
    > column house_id int PF
    > column tree_id int PK
    > column farm_id int PF
    > column count int PK
    >
    > My bug is when I try to move a "counter" object from one object
    > to another I get a nullpointer exception and badly formed sql.
    >
    > Counter counter = findCounter(house.getCountersArray());
    > newHouse.addToCountersArray(counter);
    >
    > I'll get SQL like:
    > update counter .... (moves the counter)
    > update house set where house_id = ?
    > then I get a null pointer exception. --the SQL is broken. I trace
    > through the Cayenne
    > code and see that it returns two update entities when it's preparing the
    > update batch.
    >
    > Why is it trying to do an update to the house table? There's nothing
    > there for it to update. I'm looking through my map XML file again, but
    > I've looked twice and don't see anything different from the other toMany
    > relationships
    > that I have.
    >
    > Gowry



    This archive was generated by hypermail 2.0.0 : Wed Oct 13 2004 - 08:59:53 EDT