Newbie help with error on commit. Possible relationship error?

From: Gowry Gabriev (gowry.gabrie..mail.com)
Date: Tue Oct 12 2004 - 14:39:25 EDT

  • Next message: Mike Kienenberger: "Re: Cayenne, Oracle and Date-based queries..."

    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 : Tue Oct 12 2004 - 14:39:27 EDT