Do you get a syntax error on that 'join' expression? I don't think
that's legal HQL, and whether it is or not you can get the desired
result by putting the obj.id = otherprop.id.id expression in the "where"
clause with the other qualifiers (note that the same thing is done with
the 'prop' alias, which is also a join to get the address field).
brain[sic]
-----Original Message-----
From: roopesh(a)digitalglue.in [mailto:roopesh@digitalglue.in]
Sent: Thursday, July 12, 2007 8:01 AM
To: xwiki-users(a)objectweb.org
Subject: [xwiki-users] Sorting by property of a class
Hi,
I am doing a search for all the users whose address is
matching a particular pattern. (Suppose there is an "address"
property in the UserClass). Also I want the results to be
sorted by another property, say, "username".
I found a similar query in this mailing list thread :
http://www.nabble.com/select-objects-by-class-and-sort-by-prop
erty-tf710844.html#a1871554
I tried forming the following query but it is wrong.
, BaseObject as obj, StringProperty as prop, StringProperty
as otherprop join obj.id=otherprop.id.id and
otherprop.id.name='username' where obj.name=doc.fullName and
obj.className='Users.UserClass' and obj.id=prop.id.id and
prop.id.name='address' and prop.value like '%someaddress%'
order by otherprop.value
Can anyone tell me what the correct query should be like.
Thanks in advance
Roopesh