[ 
https://issues.apache.org/jira/browse/OFBIZ-293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14904278#comment-14904278
 ] 

Martin Becker commented on OFBIZ-293:
-------------------------------------

The use of the xsi:nil attribute is basically correct but is no solution for 
the problem we have to represent NULL values in XML element attributes, used 
for entity attributes. As I see, the xsi:nil attribute is only for defining a 
XML element as NULL, in our use case the entity itself.

My thought was to improve the current logic without compromising current legacy 
data and usage. For now, empty string attribute values are ignored when loading 
XML entity data, that is just not correct. If we treat them as empty string, 
what would be the most correct solution, we not really gain a functional 
benefit but need to fix existing entity data files with for example 
...parentTypeId=""... in it.

For a full update while syncing data over the entity xml mechanism, the current 
solution with an additional specified action like "REPLACE" meets the 
requirements and the "XML Standard" by interpreting missing entity field (xml 
attributes) as NULL values. 

The gap I want to fill is the default action for loading entity XML data, where 
only explicitly defined fields are part of an update and there should be the 
possibility to "clear" single field values. There should only be very rare 
cases where someone would want to define and insert empty strings instead of 
NULL. Not even the current logic support this.

> data import - nulling fields impossible
> ---------------------------------------
>
>                 Key: OFBIZ-293
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-293
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Marco Risaliti
>            Priority: Minor
>         Attachments: OFBIZ-293_set-empty-strings-as-null.patch, 
> ofbiz-293-patch.txt, ofbiz-462-patch.txt
>
>
> It's a copy of the old-jira issue 
> http://jira.undersunconsulting.com/browse/OFBIZ-462 Tarlika Elisabeth Schmitz
> =================================================
> I am on rev 5274. 
> data import from .xml file: empty attributes (e.g. description="") are 
> ignored and the field retains its former value. 
> Comment by Chris Juettner [04/Oct/05 01:51 PM]
> This patch comments out the check for null or empty values in the data XML 
> file found by the EntitySaxReader. I also added an additional warning message 
> in case you do not want to persist empty values to the database but still 
> would like to know what happened. 
> Comment by Si Chen [04/Oct/05 01:59 PM]
> Chris- 
> Just a comment: it's very important that a field in the entity engine is set 
> to null ONLY when the XML file specifically has an empty attribute (ie, 
> description=""). Otherwise, there's a lot of seed data that is in separate 
> XML files, and they could overwrite each other. 
> Comment by Chris Juettner [10/Oct/05 11:56 AM] [ Permlink ] 
> Si, 
> I'm not sure I understand your comment about seed data in seperate XML files 
> overwriting each other. Shouldn't seed data XML files be entity specific? Why 
> would one seed data XML file overwrite another? 
> Do you have any comment on what a better solution is for seed data values 
> that could be empty? 
> Thanks 
> Chris 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to