jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Equivalent JCR_SQL2 statement
Date Wed, 11 Nov 2009 09:23:42 GMT
Hi,

please note that there are no plans to abandon XPath support in
jackrabbit. the deprecation status is only with the specification.
therefore I suggest you stick with XPath unless you need functionality
that requires JQOM or SQL-2.

On Mon, Nov 9, 2009 at 14:32, Rakesh Vidyadharan <rakesh@sptci.com> wrote:
> On 9 Nov 2009, at 1:36:25 AM, Thomas Müller wrote:
> select * from ['nt:unstructured'] where ['jcr:path'] like '/%/unitTestPage'
> and ['cms:nodeType'] = 'page'

that doesn't work because SQL-2 does not support the jcr:path pseudo
property, which is only present in JCR 1.0 SQL.

what you rather want is:

select * from [nt:base] where name() = 'unitTestPage' and
[cms:nodeType] = 'page'

regards
 marcel

> select * from [nt:unstructured] where [jcr:path] like '/%/unitTestPage' and
> [cms:nodeType] = 'page'
>
> Rakesh
>>
>>
>>
>> On Mon, Nov 9, 2009 at 8:20 AM, Thomas Müller <thomas.mueller@day.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> Try:
>>>
>>> select * from [nt:unstructured] where [jcr:path] like
>>> '/%/unitTestPage' and [cms:nodeType] = 'page'
>>>
>>> Regards,
>>> Thomas
>>>
>>>
>>> On Sun, Nov 8, 2009 at 5:30 AM, Rakesh Vidyadharan <rakesh@sptci.com>
>>> wrote:
>>>>
>>>> Since XPath is deprecated in JCR 2.0, I am trying to move to JCR_SQL2
>>>> (JR-2.0-beta1).  I have the following XPath query:
>>>>
>>>> //unitTestPage[@cms:nodeType = 'page']
>>>>
>>>> I tried writing the query in SQL as:
>>>>
>>>> select * from nt:unstructured where jcr:path like '/%/unitTestPage' and
>>>> cms:nodeType = 'page'
>>>>
>>>> This statement however fails with an exception:
>>>>
>>>> javax.jcr.query.InvalidQueryException: Query:
>>>> select * from nt:(*)unstructured where jcr:path like '/%/unitTestFolder'
>>>> and
>>>> cms:nodeType = 'page'; expected: <end>
>>>>       at
>>>>
>>>> org.apache.jackrabbit.commons.query.sql2.Parser.getSyntaxError(Parser.java:968)
>>>>       at
>>>>
>>>> org.apache.jackrabbit.commons.query.sql2.Parser.createQueryObjectModel(Parser.java:124)
>>>>       at
>>>>
>>>> org.apache.jackrabbit.commons.query.sql2.SQL2QOMBuilder.createQueryObjectModel(SQL2QOMBuilder.java:55)
>>>>       at
>>>>
>>>> org.apache.jackrabbit.core.query.QOMQueryFactory.createQuery(QOMQueryFactory.java:69)
>>>>       at
>>>>
>>>> org.apache.jackrabbit.core.query.CompoundQueryFactory.createQuery(CompoundQueryFactory.java:67)
>>>>       at
>>>>
>>>> org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery(QueryManagerImpl.java:98)
>>>>
>>>> Can some one tell me what I am missing?
>>>>
>>>> Thanks
>>>> Rakesh
>>>>
>>>>
>>>>
>>>
>
> Rakesh Vidyadharan
> President & CEO
> Sans Pareil Technologies, Inc.
> http://sptci.com/
>
>
> | 100 W. Chestnut, Suite 1305 | Chicago, IL 60610-3296 USA |
> | Ph: +1 (312) 212 3933 | Mobile: +1 (312) 315-1596 (US), +91  949 611 0873
> (IN) | Fax: +1 (312) 276-4410 | E-mail: rakesh@sptci.com
>
>
>
>
>

Mime
View raw message