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 |
[ https://issues.apache.org/jira/browse/OFBIZ-4857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Uwe Allner updated OFBIZ-4857: ------------------------------ 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.): {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. was: 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. > 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
Free forum by Nabble | Edit this page |