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

Martin Becker updated OFBIZ-293:
--------------------------------
    Attachment: OFBIZ-293_set-empty-strings-as-null.patch

I've attached an updated version of the patch from 2011.

In my opinion it would be straight forward, if the entity import would treat 
fields that are mentioned in entity XML files as fields that should be updated 
always, as the GenericDAO does. The current logic ignores fields, if there is 
only an empty string as value.

The enhancement brought by the solution of OFBIZ-4949 makes it possible to 
generally configure an entity-engine-xml file to be interpreted as replacement, 
so that all NOT mentioned fields are set to NULL instead of leaving the old 
value while updating the entity.

Nevertheless I think, that the default (update) behavior, the one with fine 
grained control over which fields are touched, should also give the possibility 
to set field values to NULL by including them in the XML.

The solution with the lowest impact on existing XML files and the most natural 
meaning should be to interpret empty string values in the XML as NULL, as it is 
today. The only difference would be, that they are not longer ignored but set 
as NULL values in the database. The only drawback I see is, that you're still 
not able to set "empty string" values as concrete values to the database (no 
loss of function, because you can't do it today, too).

As far as I can see, there should be no conflict with current existing data 
files. There are some where for example a parentTypeId is contained with empty 
string as value. Interpreting it as NULL and setting in database is exactly 
what is meant by such a definition.



> 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. 
>  
>  
>  All    Comments    Work Log    Change History       Sort Order:   
> Comment by Chris Juettner [04/Oct/05 01:51 PM] [ Permlink ] 
> 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] [ Permlink ] 
> 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. 
> Si 
> 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