You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2012/05/15 23:41:09 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=13276252#comment-13276252 ] 

Jacques Le Roux commented on OFBIZ-4857:
----------------------------------------

Would you suggest a patch?
                
> 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=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 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