random behaviour in Cayenne?

From: Hans Schmidt (han00..mx.net)
Date: Wed Aug 16 2006 - 09:45:18 EDT

  • Next message: Andrus Adamchik: "Re: Avoid automatic Bi-directional Relationship Management"

    Hi,

    I am using Cayenne 1.2 final release and the following code:

    public AiAboangebot copyToNewAngebot(AiAboangebot toCopy) {
                    ctx.commitChanges();
                    List ur = new ArrayList();
                    Integer nextId = getNextId(toCopy);
                    AiAboangebot cop =(AiAboangebot)ctx.createAndRegisterNewObject(AiAboangebot.class);
                    ur.add(cop);
                    BeanUtils.copyProperties(toCopy,cop);
                    ctx.unregisterObjects(ur);
                    cop.setId(nextId);
                    ctx.registerNewObject(cop);
                    ctx.commitChanges();
                    return cop;
            }

    the purpose of the code is to copy an existing db-row, assign a new id and edit it.
    the code sometimes works but sometimes not.

    It seems the relations are sometimes broken so that the generated SQL tries to insert NULL values into non-nullable columns.

    any help would be greatly appreciated.

    greetings
    Hans

    -- 
    

    Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



    This archive was generated by hypermail 2.0.0 : Wed Aug 16 2006 - 09:46:52 EDT