Re: Objects stored in DB despite optimistic locking

From: Nikolai Raitsev (nikolai.raitse..mail.com)
Date: Thu Jul 27 2006 - 12:59:18 EDT

  • Next message: Nikolai Raitsev: "Re: Objects stored in DB despite optimistic locking"

    I found the problem and probably a bug in cayenne...

    here is a part of my log:

    on first run, insert:

    INFO QueryLogger: INSERT INTO WPTAB (WPTAB_AENKZ, WPTAB_ISIN, WPTAB_LOEKZ)
    VALUES (?, ?, ?)
    INFO QueryLogger: [bind: ' ', 'DE0000044444', ' ']

    Attention, in ' ' is one blank!!!!

    on second run, update:

    INFO QueryLogger: UPDATE WPTAB SET WPTAB_AENKZ = ?, WPTAB_LOEKZ = ? WHERE
    WPTAB_ISIN = ?
    INFO QueryLogger: [bind: ' ', ' ', 'DE0000044444']

    Attention, and here in ' ' is one blank!!!!
    The Fields WPTAB_AENKZ and WPTAB_LOEKZ has not changed, why cayenne does
    those update?

    Have everybody a tip for me, what can I do?

    thanks and best regards,

    Nikolai

    2006/7/27, Nikolai Raitsev <nikolai.raitse..mail.com>:
    >
    > Hello
    >
    > How works optimistic locking?
    >
    > I understand it such (see
    > http://cwiki.apache.org/CAY/optimistic-locking-explained.html):
    >
    > if no data changed in the dataset, is this data record not updated in the
    > database.
    >
    > i have following problem:
    > first run:
    > i have 20000 datarecords in a table 1. This dataset I copy with cayenne
    > into another table 2.
    > I use setProperty method, like this:
    >
    > attrListParameter =
    > p_dataObjectInt.getObjEntity().getAttributes().toArray();
    >
    > int nSizeAttrListParameter = attrListParameter.length;
    > ObjAttribute attr;
    > String sAttrName;
    >
    > for(int i = 0; i<nSizeAttrListParameter; i++)
    > {
    > attr = (ObjAttribute) attrListParameter[i];
    > sAttrName = attr.getName();
    > p_dataObject.writeProperty(sAttrName,
    > p_dataObjectInt.readProperty(sAttrName));
    > }
    >
    > I make commit to the end, commit duratation is 11 sec.
    >
    > second run:
    > i have 20000 datarecords in a table 1 and in table 2.
    > I copy this 20000 records once again into table 2 (the data is not
    > changed!) with code from above and commit changes, but commit duratation is
    > also 11 sec.!!!! No data has changed!, optimistic locking is set in my
    > XXX.map.xml for class from p_dataObject and for all attributes.
    >
    > in the second run is to be sent nevertheless update for all 20000
    > datarecords, or?
    >
    > what i do wrong???
    >
    > with thanks, nikolai
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Jul 27 2006 - 12:59:42 EDT