0 Replies Latest reply on Oct 18, 2004 6:04 AM by Terry Paterson

    modified-strategy bug ?

    Terry Paterson Newbie

      Using JBoss 3.2.5, "Instance Per Transaction CMP 2.x Container", optimistic-locking, and modified-strategy..

      I have a problem whereby the "modified" field used in the WHERE clause for the UPDATE seems to be wrong (includes fields which have not changed).

      I've setup a little test case which gets a value object from the Company entity, updates the address1 field in the VO then uses the VO to update the entity.

      the setCompanyValue method in the Entity looks like this :

      public void setCompanyValue(CompanyValue vo) {
      setYardName(vo.getYardName());
      setAddress1(vo.getAddress1());
      setAddress2(vo.getAddress2());
      //etc
      }

      when I run my test I get the following in my logs :


      2004-10-08 16:14:10,288 DEBUG [Company] optimistic locking: modified strategy

      16:28:08,597 DEBUG [Company] Executing SQL: UPDATE company SET address1=? WHERE site_id=? AND yard_id=? AND yardname=? AND maincontact=? AND address1=? AND address2=? AND address3=? AND city=? AND state=? AND zip=? AND phone1=? AND phone2=? AND fax=? AND email=? AND yardurl=? AND dealernumber=? AND taxid=? AND taxname1=? AND taxrate1=? AND taxname2=? AND taxrate2=? AND threshold1=? AND threshold2=? AND taxrule1=? AND taxrule2=? AND statementlastrun=? AND statementenddate=? AND version=?


      only the address1 field was updated - and of course this is included in the SET part of the SQL but the other fields should'nt be included in the WHERE clause,

      anyone know how I can fix this ?