Objects stored in DB despite optimistic locking

From: Nikolai Raitsev (nikolai.raitse..mail.com)
Date: Thu Jul 27 2006 - 10:22:47 EDT

  • Next message: Lothar Krenzien: "Re: LRUMap.reuseMapping exception with 1.2B3"

    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.xmlfor 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 - 10:23:19 EDT