You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Sharan Foga (JIRA)" <ji...@apache.org> on 2015/02/21 08:34:21 UTC

[jira] [Updated] (OFBIZ-4857) Check in GenericEntity.set whether the new value is different from the current one

     [ https://issues.apache.org/jira/browse/OFBIZ-4857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sharan Foga updated OFBIZ-4857:
-------------------------------
    Sprint: Bug Crush Event - 21/2/2015

> 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
>            Assignee: Adam Heath
>
> 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=GenericEntity.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 was sent by Atlassian JIRA
(v6.3.4#6332)