Problems with getLastModified() function


in my new application I want to store a spezial Index of several values that are calculated from Elements in a Document. To keep the consistency with the Document, I want to check, if the Document was changed since the Index was stored.
Therefor I want to store the creation-time of the Index und compare it with the lastModified-Date of the Document.

I tried the following X-Query:

declare namespace tf=""

for $a in input()/Gebaeude
where $a/@grundstueck_id="5"

return tf:getLastModified($a)

But I always get the following Error-Message:

 <?xml version="1.0" encoding="windows-1252" ?> 
- <ino:response xmlns:ino="" xmlns:xql="">
- <xq:query xmlns:xq="">
- <![CDATA[ 
declare namespace tf=""

for $a in input()/Gebaeude
where $a/@grundstueck_id="5"

return tf:getLastModified($a)

- <ino:message ino:returnvalue="0">
  <ino:messageline>XQuery Request processing</ino:messageline> 
  <xq:result xmlns:xq="" /> 
- <ino:message ino:returnvalue="6301">
  <ino:messagetext ino:code="INOXQE6301">Runtime type exception</ino:messagetext> 

I’m sure, you’ve got a solution for me.


I tried to run the X-Query in a small Java-App. See the code:

try {
			TaminoClient tc = new TaminoClient("http://localhost/tamino/BSDB30032005");
			String query = "Gewichtungsfaktoren[@ino:id='1']";
			TaminoResult tr = tc.query(query, "Hessen");
			System.err.println("Last: "+tr.getLastModified().toString());
		} catch (TaminoError e) {
			// TODO Auto-generated catch block

I always get the following output:

Last: Thu Jan 01 01:00:00 CET 1970

For me, it seems as if the program doesn’t get any documents from the database. But I don’t understand why?


the error is probably that tf:getLastModified can only be applied on document node, i.e. try the following:

declare namespace tf=“

for $a in input()/Gebaeude
where $a/@grundstueck_id=“5”

return tf:getLastModified(root($a))

But you might consider using a trigger to keep your “index” up to date.



This doesn’t work either.

Can you tell me something more about a trigger. I’ve never heard anything about it before.

Ok, it works now in the Interactive Interface. I had an Error in the Where-clause.

The correct code looks like this:

declare namespace tf=""

for $a in input()/Gebaeude[@grundstueck_id = 5]

return <time>{tf:getLastModified(root($a))}</time>

Can you tell me, how I implement the “root($a)”-part in Java?


Tamino schema editor allows you to bind an action to a node, where the action is called whenever the node is inserted, modified or deleted (onInsert, onUpdate, onDelete). The action is a server extension that you can write in Java or another supported programming language and install in the database (see section on Server Extensions in the documentation)