You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ulrich <Fo...@gombers.de> on 2013/06/21 10:39:19 UTC
Query: Compare two properties of a node
I need to compare two DATE-properties and work on those nodes where the first
date is "after" the other one. From the specs I understand, that in the
comparison one of the parameters has to be static; so there is no way to do what
I want.
And in fact the query:
"select [my:ownDate] from [nt:resource] as mynode " +
"WHERE ISDESCENDANTNODE([/content/testit]) AND [jcr:lastModified] >
[my:ownDate]";
fails with Exception: "javax.jcr.query.InvalidQueryException: Query: ....
expected: static operand"
while
"select [my:ownDate] from [nt:resource] as mynode " +
"WHERE ISDESCENDANTNODE([/content/testit]) AND [jcr:lastModified] >
'2013-06-12T18:05:59.109+02:00'";
works fine.
Did I get this right? Is there a trick? Otherwise I have to traverse all nodes
(several hundert thousands) day per day.
Thanks and best regards,
Ulrich
Re: Query: Compare two properties of a node
Posted by Alexander Klimetschek <ak...@adobe.com>.
Yes, that's right, you cannot compare 2 properties (would be a join, and there are only few joins possible based on the node hierarchy containment).
Cheers,
Alex
On 21.06.2013, at 10:39, Ulrich <Fo...@gombers.de> wrote:
> I need to compare two DATE-properties and work on those nodes where the first
> date is "after" the other one. From the specs I understand, that in the
> comparison one of the parameters has to be static; so there is no way to do what
> I want.
> And in fact the query:
> "select [my:ownDate] from [nt:resource] as mynode " +
> "WHERE ISDESCENDANTNODE([/content/testit]) AND [jcr:lastModified] >
> [my:ownDate]";
> fails with Exception: "javax.jcr.query.InvalidQueryException: Query: ....
> expected: static operand"
>
> while
> "select [my:ownDate] from [nt:resource] as mynode " +
> "WHERE ISDESCENDANTNODE([/content/testit]) AND [jcr:lastModified] >
> '2013-06-12T18:05:59.109+02:00'";
> works fine.
>
> Did I get this right? Is there a trick? Otherwise I have to traverse all nodes
> (several hundert thousands) day per day.
>
> Thanks and best regards,
> Ulrich