just tried to receive a TXMLObject from the database, modify it and perform an update with it. I used the example shown in the documentation for TaminoAPI4Java as reference but it didnt work.
The following exception was thrown:
com.softwareag.common.instrumentation.contract.ViolatedPrecondition: Violated Precondition: Update not possible. TXMLObject instance does not contain an ino:id!
at com.softwareag.common.instrumentation.contract.Precondition.check(Unknown Source)
at com.softwareag.tamino.db.api.accessor.TStreamAccessorImpl.update(Unknown Source)
at com.softwareag.tamino.db.api.accessor.TXMLObjectAccessorImpl.update(Unknown Source)
Exception in thread “main”
It seems as if my TXMLObject has no ino:id. But I just received it from the database, slightly modified it and then tried to update it.
It might be that this question has already posted. But the Keyword search for the forum (in the dropdown box) doesnt return any results, no matter which word I entered.
Thanks a lot in advance,
I tried a
System.out.println(“Ino:ID” + xmlObject.getI());
and as expected there was no return.
I understand now that my TXMLObject needs to have an ino:id so that the update knows where to insert the xmlObject. But how can I get this id?
OK, now I tried to insert an ino:id on my own like this:
23 is my age, so just a random number
Now the database returns the following exception:
Access failed:Tamino access failure (INOXDE7935, Schema not found, Failed to locate schema for doctype ‘Person’ in collection ‘TigerCollection’.)
Seems as if my database is not configured well.
Thanks a lot,
Good night (definitely no more work for tonight),
[This message was edited by Hoscha on 11 March 2004 at 23:43.]
You don’t always get an ino:id. This is almost certainly true if you use XQuery to obtain the document. You are generally better off using your own docnames rather than using Tamino’s automatic docnames (ino:id).
I believe that you are not permitted to insert to your own id but you are allowed to insert to your own docname.
You normally have to define a schema before being able to insert documents.
Thanks for the fast reply. Thats weird cause I have already inserted a schema into the database.
it might be easier to perform a language-driven update rather than retrieve the document via XQuery, manipulate it and then re-submit it.
The following page in the documentation explains how to write XQuery update expressions:
...\Software AG\Tamino\Tamino 22.214.171.124\Documentation\xquery\xq-update.htm
I hope that helps,
Thanks for your proposal, Trevor.
But I think the way to insert it via XQuery and with a TXMLObject would perfectly fit to our application.
One question left:
> You don’t always get an ino:id.
> This is almost certainly true if
> you use XQuery to obtain the document
I obtain the document with the help of XQuery. So, xmlObject.getID() should return an ino:id shouldnt it? In my case, it returns nothing and even if a schema is defined now, the exception “TXMLObject instance does not contain an ino:id!” is thrown.
I dont want to insert to my own ino:id, I just want to update an element related to an existing ino:id.
Kind Regards, Holger
Maybe I havent read your reply thoroughly. that means that I wont get any ino:id when retrieving the document via XQuery, right?
How can I update a document that I have first obtained with XQuery with an accessor ? Like this: response = accessor.update(xmlObject);
Thanks a lot in advance,
[This message was edited by Hoscha on 15 March 2004 at 10:46.]
Ok, all in all, I think we will use Marks proposal to include the update in a XQuery. In addition, this approach resembles more the SQL-update.