Would this perhaps be why I can't use an arbitrary expression as a result field? Specifically, my query for objects less than a week old used the SQL expression: subdate(curdate(), 7) which worked fine when used in a comparison to a date field in the WHERE clause, but provoked an error when I tried to use it in the column-list, which is (I believe) clearly legal SQL syntax. If this were a feature that HQL simply didn't support, it would explain the problem. Indeed, that is what the error message seems to say: Error number 4001 in 4: Error while parsing velocity page Brian.WorkPagesTest Wrapped Exception: Invocation of method 'search' in class com.xpn.xwiki.api.XWiki threw exception class com.xpn.xwiki.XWikiException : Error number 3223 in 3: Exception while searching documents with sql select subdate(curdate(), 7), prop.value, [...] where [...] or subdate(curdate(), 7) <= prop.value ) [...] Wrapped Exception: No data type for node: org.hibernate.hql.ast.MethodNode +-METHOD_CALL? MethodNode: '(' | +-METHOD_NAME? IdentNode: 'subdate' {originalText=subdate} | -EXPR_LIST? SqlNode: 'exprList' | +-METHOD_CALL? MethodNode: '(' | | +-METHOD_NAME? IdentNode: 'curdate' {originalText=curdate} | | -EXPR_LIST? SqlNode: 'exprList' | -NUM_INT? LiteralNode: '7' brain[sic] -----Original Message----- From: jeremi joslin [mailto:[email protected]] Sent: Thursday, March 23, 2006 10:47 PM To: [email protected] Subject: Re: [xwiki-users] SQL hair-pulling Yes, XWiki is using hibernate for the database mapping. So it's not a sql query, but a hql query. You use the objects and members name to make the request. (if you don't know the hql, you can take a look to the hibernate documentation : http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#queryhql) Jérémi