Uwe Allner created OFBIZ-4857:
---------------------------------

             Summary: Check in GenericEntity.set whether the new value is 
different from the current one
                 Key: OFBIZ-4857
                 URL: https://issues.apache.org/jira/browse/OFBIZ-4857
             Project: OFBiz
          Issue Type: Improvement
          Components: framework
            Reporter: Uwe Allner


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.):

{code:title=Bar.java|borderStyle=solid}
      Object old = fields.get(name);
            
      if(!ObjectUtils.equals(old, value)) {
          fields.put(name, value);
          generateHashCode = true;
          modified = true;
          this.setChanged();
          this.notifyObservers(name);
      }
{code} 

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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to