Huh... Sounds intriguing, but I'm puzzled about a lot of details, like: how do you do that? Probably an example would be very useful. Do you have one handy? brain[sic] -----Original Message----- From: Mark Robinson [mailto:[email protected]] Sent: Friday, March 24, 2006 10:48 AM To: [email protected] Subject: Re: HQL question (wasRE: [xwiki-users] SQL hair-pulling) It seems to be like ADODB, forget about query strings. Create an object. Set variables, indicate the relationships (eg joins) and call the method fpr retrieving the data. Result data as an object. Updates are a breeze. Cheers, Mark On 25 Mar 2006, at 12:32 AM, THOMAS, BRIAN M ((SBCSI)) wrote:
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
-- You receive this message as a subscriber of the xwiki- [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/ wws