Another Update Problem!

my codes:

public static int GetUniqueID(String dbURL)
throws Exception
{
TaminoClient taminoClient;
TaminoResult taminoResult;
taminoClient = new TaminoClient(dbURL);
taminoClient.startSession();
taminoResult = taminoClient.query("*",“UniqueID”);
Document doc = taminoResult.getDocument();
String id = DOMWrapper.getDOMElementTextByTagName(doc.getDocumentElement(),“UniqueID”);
System.out.println(doc);
int UniqueID = (Integer.parseInt(id.trim())) + 1;
Element element = (Element)doc.getElementsByTagName(“UniqueID”).item(0);
element.getChildNodes().item(0).setNodeValue(id.valueOf(UniqueID));
System.out.println(element);
TaminoResult tr = taminoClient.update(element);
System.out.println(“result:” + tr.getDocument());
taminoClient.endSession();

return 0;
}
}


console info:

<?xml version='1.0'?><ino:response xmlns:ino=‘http://namespaces.softwareag.com/tamino/response2’ xmlns:xql=‘http://metalab.unc.edu/xql/’ ino:sessionid=‘11’ ino:sessionkey=‘12548’>xql:queryUniqueID</xql:query><ino:message ino:returnvalue=‘0’>ino:messagelineXQL Request processing</ino:messageline></ino:message>xql:result
0
</xql:result><ino:cursor ino:count=‘1’><ino:first ino:href=’?_XQL(1,5)=UniqueID’></ino:first></ino:cursor><ino:message ino:returnvalue=‘0’>ino:messagelineXQL Request processed</ino:messageline></ino:message></ino:response>

1

result:<?xml version='1.0'?><ino:response xmlns:ino=‘http://namespaces.softwareag.com/tamino/response2’ xmlns:xql=‘http://metalab.unc.edu/xql/’ ino:sessionid=‘11’ ino:sessionkey=‘23136’><ino:message ino:returnvalue=‘0’>ino:messagelinedocument processing started</ino:messageline></ino:message><ino:object ino:collection=‘ino:etc’ ino:doctype=‘UniqueID’ ino:id=‘1’></ino:object><ino:message ino:returnvalue=‘0’>ino:messagelinedocument processing ended</ino:messageline></ino:message></ino:response>

You didn’t specify the problem.
If it is that the document is stored in ino:etc instead of be updated in your collection, then I think you must use another “update” method like:
update(org.w3c.dom.Element element,
java.lang.String collection,
java.lang.String doctype)

The reason is that you don’t include the collection in the dbURL (so you use “query(query,collection)”) and then at update time, the collection is missing.

Regards.

[This message was edited by Juanjo on 29 Aug 2002 at 08:36.]

Thank you :slight_smile:
I need a UniqueID for each of my Issues,u have solved my problem. update successfully.