I had problems with HQL statements containing parentheses used to help
humans see the logic more easily, but not needed by the logic itself. When I
removed the parentheses and changed the equation to take advantage of
built-in operator precedence...  then it worked.

I'm not saying that is the problem or whether it's an issue with date
comparisons like the use of $xwiki.getDate() is in a date subtraction, or
whether it is missing quotes since the velocity substitutions happen at a
different time thant he HQL evaluation....

However, since the problem area is similar to what happened when I had extra
parentheses, perhaps try replacing ($xwiki.getDate() -
doc.contentUpdateDate) < 15
with $xwiki.getDate()-doc.contentUpdateDate<15 ???

For example, the following only worked if I remove all parentheses around
the inequality comparisons:
#set($hqlQuery = ", XWikiRCSNodeInfo as ni where doc.id=ni.id.docId and
ni.id.version2=1 and doc.space<>'XWiki' and doc.space<>'Main' and
doc.space<>'Panels' group by doc.space, doc.name order by max(ni.date)

(output: http://nielsmayer.com/xwiki/bin/view/Timeline/ChangesList?xpage=rdf
code: http://nielsmayer.com/xwiki/bin/view/Timeline/ChangesList?viewer=code
app using: http://nielsmayer.com/xwiki/bin/view/Timeline/TL2 )

Is this parenthesis behavior a bug? Or is there some special escaping needed
for HQL parentheses?


On Fri, Mar 6, 2009 at 8:18 AM, MaryEllen Coleman <m...@us.ibm.com> wrote:

> Hello! I need an HQL query that does the following:
>        Last modified date should be less than 15 days from today
> This is what I've tried:
>        #set($sql = ", BaseObject as obj, $proptype as prop where
> obj.className='${ISDclassname}' and obj.id=prop.id.id and
> prop.name='${viewby}' and doc.fullName=obj.name and
> doc.fullName!='${ISDclasstemplate}' and ($xwiki.getDate() -
> doc.contentUpdateDate) < 15 order by prop.value")
> But I'm getting an error on the and ($xwiki.getDate() -
> doc.contentUpdateDate) < 15 statement.  What should I write instead?
> Mary Ellen Coleman
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
users mailing list

Reply via email to