Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 36173 invoked from network); 11 Nov 2009 09:24:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Nov 2009 09:24:17 -0000 Received: (qmail 97660 invoked by uid 500); 11 Nov 2009 09:24:16 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 97629 invoked by uid 500); 11 Nov 2009 09:24:16 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 97618 invoked by uid 99); 11 Nov 2009 09:24:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 09:24:16 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mreutegg@day.com designates 207.126.148.89 as permitted sender) Received: from [207.126.148.89] (HELO eu3sys201aog103.obsmtp.com) (207.126.148.89) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 11 Nov 2009 09:24:04 +0000 Received: from source ([209.85.219.205]) by eu3sys201aob103.postini.com ([207.126.154.11]) with SMTP ID DSNKSvqCoKZHc6xqQnWb2/ngYXSl/hK8kYMn@postini.com; Wed, 11 Nov 2009 09:23:44 UTC Received: by ewy1 with SMTP id 1so685124ewy.3 for ; Wed, 11 Nov 2009 01:23:44 -0800 (PST) MIME-Version: 1.0 Sender: mreutegg@day.com Received: by 10.216.90.210 with SMTP id e60mr390956wef.120.1257931422481; Wed, 11 Nov 2009 01:23:42 -0800 (PST) In-Reply-To: <1EF092A8-8EA5-4BE1-AB9F-4C2D8F8EE3C7@sptci.com> References: <91f3b2650911082320n4eb3d974w92b5b993268e503f@mail.gmail.com> <91f3b2650911082336n8d50dc3oe08bf8348420682b@mail.gmail.com> <1EF092A8-8EA5-4BE1-AB9F-4C2D8F8EE3C7@sptci.com> Date: Wed, 11 Nov 2009 10:23:42 +0100 X-Google-Sender-Auth: dc24f402a4602596 Message-ID: Subject: Re: Equivalent JCR_SQL2 statement From: Marcel Reutegger To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 wrote: > On 9 Nov 2009, at 1:36:25 AM, Thomas M=FCller wrote: > select * from ['nt:unstructured'] where ['jcr:path'] like '/%/unitTestPag= e' > and ['cms:nodeType'] =3D '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() =3D 'unitTestPage' and [cms:nodeType] =3D 'page' regards marcel > select * from [nt:unstructured] where [jcr:path] like '/%/unitTestPage' a= nd > [cms:nodeType] =3D 'page' > > Rakesh >> >> >> >> On Mon, Nov 9, 2009 at 8:20 AM, Thomas M=FCller >> wrote: >>> >>> Hi, >>> >>> Try: >>> >>> select * from [nt:unstructured] where [jcr:path] like >>> '/%/unitTestPage' and [cms:nodeType] =3D 'page' >>> >>> Regards, >>> Thomas >>> >>> >>> On Sun, Nov 8, 2009 at 5:30 AM, Rakesh Vidyadharan >>> wrote: >>>> >>>> Since XPath is deprecated in JCR 2.0, I am trying to move to JCR_SQL2 >>>> (JR-2.0-beta1). =A0I have the following XPath query: >>>> >>>> //unitTestPage[@cms:nodeType =3D 'page'] >>>> >>>> I tried writing the query in SQL as: >>>> >>>> select * from nt:unstructured where jcr:path like '/%/unitTestPage' an= d >>>> cms:nodeType =3D 'page' >>>> >>>> This statement however fails with an exception: >>>> >>>> javax.jcr.query.InvalidQueryException: Query: >>>> select * from nt:(*)unstructured where jcr:path like '/%/unitTestFolde= r' >>>> and >>>> cms:nodeType =3D 'page'; expected: >>>> =A0 =A0 =A0 at >>>> >>>> org.apache.jackrabbit.commons.query.sql2.Parser.getSyntaxError(Parser.= java:968) >>>> =A0 =A0 =A0 at >>>> >>>> org.apache.jackrabbit.commons.query.sql2.Parser.createQueryObjectModel= (Parser.java:124) >>>> =A0 =A0 =A0 at >>>> >>>> org.apache.jackrabbit.commons.query.sql2.SQL2QOMBuilder.createQueryObj= ectModel(SQL2QOMBuilder.java:55) >>>> =A0 =A0 =A0 at >>>> >>>> org.apache.jackrabbit.core.query.QOMQueryFactory.createQuery(QOMQueryF= actory.java:69) >>>> =A0 =A0 =A0 at >>>> >>>> org.apache.jackrabbit.core.query.CompoundQueryFactory.createQuery(Comp= oundQueryFactory.java:67) >>>> =A0 =A0 =A0 at >>>> >>>> org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery(QueryMan= agerImpl.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 =A0949 611 = 0873 > (IN) | Fax: +1 (312) 276-4410 | E-mail: rakesh@sptci.com > > > > >