Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-4857

Check in GenericEntity.set whether the new value is different from the current one

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • framework
    • None
    • Bug Crush Event - 21/2/2015

    Description

      In GenericEntity.set(String name, Object value, boolean setIfNull) after the necessary type conversions and checks it should first be verified that the new value is different from the currently set, before the state is set to changed/modified and observers are notified. E.g. (line 432 ff.):

      GenericEntity.java
            Object old = fields.get(name);
                  
            if(!ObjectUtils.equals(old, value)) {
                fields.put(name, value);
                generateHashCode = true;
                modified = true;
                this.setChanged();
                this.notifyObservers(name);
            }
      

      Also the store in the GenericDelegator should be dependant on the modified-flag of the GenericValue to save.
      Update operations could be done more elegantly, and execution time would potentially be saved.

      Attachments

        Activity

          People

            doogie Adam Heath
            uallner Uwe Allner
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: