Re: [bdbxml] Document modifications are not applied

Stephan Korthoff <[email protected]>
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
XmlUpdateContext.setApplyChangesToContainer ist true

BerkModifier.execute( docValue, context,  BerkUpdContext);
XmlDocument retDoc2 = BerkContainer.getDocument (docId)

System.out.println("DEBUG docValue ret2: " + retDoc2.getContentAsString());

The last line shows the document as it was before.


Stephan



George Feinberg wrote:

>
> In order to make updates persistent in the database,
> you must either (1)  call XmlUpdateContext.setApplyChangesToContainer 
> (true)
> on the XmlUpdateContext used for the modification, or
> (2) explicitly call XmlContainer.updateDocument() with
> the new document, after the modification.
>
> Without either of these, the modification only applies
> to the in-memory copy of the document.
>
> Regards,
>
> George
>
>> Does nobody have an idea what the problem could be?
>>
>> Stephan
>>
>>
>> Stephan Korthoff wrote:
>>
>>
>>> Hello,
>>>
>>> I've got a problem with the modification of documents. I took the
>>> modification example from sleepycat.com and
>>> implemented an attribute value change as follows:
>>>
>>>
>>>   ....             try
>>> {
>>>   XmlModify BerkModifier = BerkManager.createModify();
>>>   XmlQueryContext context = BerkManager.createQueryContext();
>>>
>>>   XmlQueryExpression BerkQExp =
>>> BerkManager.prepare("collection('xmachberk.dbxml')/kenndaten 
>>> [@doc_id=d" +                    String.valueOf(intDocId) +
>>> "]/felder_als_attribute/@double_feld_r", context);
>>>
>>>   System.out.println("DEBUG Anfrage:
>>> collection('xmachberk.dbxml')/kenndaten[@doc_id=d"  
>>> +                    String.valueOf(intDocId) +
>>> "]/felder_als_attribute/@double_feld_r");
>>>
>>>   BerkModifier.addUpdateStep(BerkQExp, newAttributeValue );
>>>    System.out.println("DEBUG retdoc: " + retDoc.getContentAsString ());
>>>
>>>   XmlDocument retDoc = BerkContainer.getDocument(docId);
>>>
>>>   XmlValue docValue = new XmlValue(retDoc);
>>>              System.out.println("DEBUG docValue asString: " +  
>>> docValue.asString());
>>>                          BerkModifier.execute( docValue, context,  
>>> BerkUpdContext);
>>>              XmlDocument retDoc2 = BerkContainer.getDocument 
>>> (docId); // +
>>> String.valueOf(intDocId));
>>>              System.out.println("DEBUG docValue ret2: " +
>>> retDoc2.getContentAsString());
>>>   }
>>>
>>> ...
>>>
>>>
>>> The problem is that the document will not be modified. The line
>>> System.out.println("DEBUG retdoc: " + retDoc.getContentAsString());
>>>
>>> gives me the same output as
>>> System.out.println("DEBUG docValue ret2: " +  
>>> retDoc2.getContentAsString());.
>>>
>>> And a manual check with the console utility gives me of course the  
>>> same
>>> result.
>>>
>>>
>>>
>>> Any help is highly appreciated.
>>>
>>>
>>> Best regards,
>>>
>>>
>>> Stephan Korthoff
>>>
>>>
>>>
>>
>>
>>
>> ------------------------------------------
>> To remove yourself from this list, send an
>> email to [email protected]
>>
>>
>
>
>
> ------------------------------------------
> To remove yourself from this list, send an
> email to [email protected]
>
>



------------------------------------------
To remove yourself from this list, send an
email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.