[ https://issues.apache.org/jira/browse/OFBIZ-4949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13499601#comment-13499601 ]
Paul Foxworthy commented on OFBIZ-4949: --------------------------------------- Hi all, I think there's two fundamental problems with the patch. The core are these lines: + for (String fieldName : currentEntity.getAllFieldNames() ){ + if ( ! ModelEntity.STAMP_FIELD.equals(fieldName) && ! ModelEntity.STAMP_TX_FIELD.equals(fieldName) + && ! ModelEntity.CREATE_STAMP_FIELD.equals(fieldName) && ! ModelEntity.CREATE_STAMP_TX_FIELD.equals(fieldName) + && currentValue.get(fieldName) == null ) { + currentValue.set(fieldName, null); + } + } Problem 1: Won't this code replace a null with a null? I suspect line 4 was intended to be + && currentValue.get(fieldName) != null ) { Problem 2: Won't *every* attribute be overwritten with a null, even those where we read a new value from the file a moment earlier? I think we can't just use getAllFieldNames - rather we would need to identify the fields untouched by data from the file. Am I missing something? Thanks Paul Foxworthy > Add a new attribute for entity-engine-xml tag, set-other-fields-to-null= > true, if it exists at the beginning data file, all updates will set to null > all fields not detailed in the file > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: OFBIZ-4949 > URL: https://issues.apache.org/jira/browse/OFBIZ-4949 > Project: OFBiz > Issue Type: Sub-task > Components: framework > Affects Versions: SVN trunk > Reporter: Olivier Heintz > Priority: Minor > Attachments: OFBIZ-4949.patch, OFBIZ-4949.patch, OFBIZ-4949.patch > > > This enhancement is useful when a entity is load by reader (ex: seed) and > sometime, it could be modify in data file. If a field is change from a value > to null, currently this modification will not be done in the next load. > For portletWidget, entity PortalPortal have a lot of field with potential > default value, so sometime, first release use some field and when it's > reviewed and corrected, some field are changed to null to use the default > value (to follow best practice). > This enhancement will be very useful for portletData file. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira