After searching through documentation on JPQL (JPA's query language) I was
unable to find any
example of the "doc.object(XWiki.XWikiUsers)" construct. This means XWQL is
it's own standard and
there is no authoritative reference on it. What makes an implementation
compliant? I have found that
most HQL queries can be executed as XWQL queries with little or no modification
so if compliance is
defined as being "just like the reference implementation" then nearly all HQL
must be implemented in
order to be compliant.
Looking at the specifications I have rewritten the example query in compliant
JPQL and JDOQL.
I wrote these so that they would work if all objects were custom mapped which
is similar to the
appearance XWQL gives.
XWQL:
(SELECT doc.fullName FROM XWikiDocument as doc) where doc.author =
'XWiki.LudovicDubost' and
doc.object(XWiki.XWikiUsers).email like '%xwiki.com'
JPQL:
SELECT doc.fullName FROM XWikiDocument as doc, IN(doc.xObjects) obj WHERE
obj.className =
'XWiki.XWikiUsers' and obj.email LIKE '%xwiki.com'
JDOQL:
SELECT this.fullName FROM XWikiDocument WHERE this.xObjects.containsValue(obj)
&& obj.className ==
"XWiki.XWikiUsers" && obj.email.startsWith("xwiki.com")
I understood that XWQL was simply a translation scheme which made it appear
that we were using JPQL
with the schema we wanted when really we were using HQL with the schema we had.
Given that it is not
compliant JPQL that is not the case.
I think when we update the schema, we should cut our losses with this thing and
move to something
which has a reference document and is more widely used.
WDYT?
Caleb
The JPQL specification (originally called EJBQL):
ejb-3_0-fr-spec-ejbcore.pdf chapter 9.
http://jcp.org/aboutJava/communityprocess/final/jsr220/
The JDOQL specification:
jdo-3_0-mrel3-spec.pdf chapter 26.
http://db.apache.org/jdo/specifications.html
Easy to read, example rich descriptions:
http://www.datanucleus.org/products/accessplatform_3_0/jpa/jpql.html
http://www.datanucleus.org/products/accessplatform_3_0/jdo/jdoql.html
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs