You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by "De Georges, Adrien" <Ad...@experian.com> on 2011/04/01 11:52:07 UTC

JCR-SQL2 where clause is not working

Hi guys,

We are using SQL queries to retrieve some nodes in the repository.
And we are encountering some problem when using 'WHERE' clause as no
element is found. We have other queries which are working correctly. But
it fails each time we use 'WHERE' with '=' or 'contains' ('is not null'
is working fine).
Our query is quiet simple : 
Select * from nt:base WHERE PARENT_UUID = 'id'.

Do you have any idea? Somebody is experiencing a same problem?

Thanks
Adrien



Information in this e-mail and any attachments is confidential, and may not be copied or used by anyone other than the addressee, nor disclosed to any third party without our permission. There is no intention to create any legally binding contract or other binding commitment through the use of this electronic communication unless it is issued in accordance with the Experian Limited standard terms and conditions of purchase or other express written agreement between Experian Limited and the recipient. Although Experian has taken reasonable steps to ensure that this communication and any attachments are free from computer virus, you are advised to take your own steps to ensure that they are actually virus free. 

Companies Act information: Registered name: Experian Limited. Registered office: Landmark House, Experian Way, NG2 Business Park, Nottingham, NG80 1ZZ, United Kingdom. Place of registration: England and Wales. Registered number: 653331


RE: JCR-SQL2 where clause is not working

Posted by Tomás Temprano <tt...@Toyota.com.ve>.
You can do something like this:

Select * 
from [wrn:file] as files 
inner join [wrn:document] as documents 
on ISCHILDNODE(documents , files) 
where ISCHILDNODE(files, 'something') 
and contains(documents.[wrp:facets],'something else')
order by files.[jcr:created] desc";

This query actually checks for properties on the child node but you can easily to check for a certain property value on the parent node (files in this case)

Tomás Temprano

-----Mensaje original-----
De: PALMER, THOMAS C (ATTCORP) [mailto:TP3310@att.com] 
Enviado el: Viernes, 01 de Abril de 2011 02:33 p.m.
Para: users@jackrabbit.apache.org
Asunto: RE: JCR-SQL2 where clause is not working

Hey Alex -
I see the use of WHERE ISCHILDNODE... but is there a way to also assert that the parent has a certain property value (in addition to my target node meeting some criteria)?

Thanks!

-----Original Message-----
From: Alex Parvulescu [mailto:alex.parvulescu@gmail.com]
Sent: Friday, April 01, 2011 6:09 AM
To: users@jackrabbit.apache.org
Cc: De Georges, Adrien
Subject: Re: JCR-SQL2 where clause is not working

Hi Adrien,

You can take a look here [1] to see how to build an SQL2 query involving a parent node.
Basically you should use ISCHILDNODE.

See [2] for the specs.

[1]
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/tes
t/java/org/apache/jackrabbit/core/query/FulltextSQL2QueryTest.java

[2] http://www.day.com/specs/jcr/2.0/6_Query.html#6.7.12 Constraint

best,
alex

On Fri, Apr 1, 2011 at 11:52 AM, De Georges, Adrien < Adrien.DeGeorges@experian.com> wrote:

> Hi guys,
>
> We are using SQL queries to retrieve some nodes in the repository.
> And we are encountering some problem when using 'WHERE' clause as no 
> element is found. We have other queries which are working correctly.
But
> it fails each time we use 'WHERE' with '=' or 'contains' ('is not
null'
> is working fine).
> Our query is quiet simple :
> Select * from nt:base WHERE PARENT_UUID = 'id'.
>
> Do you have any idea? Somebody is experiencing a same problem?
>
> Thanks
> Adrien
>
>
>
> Information in this e-mail and any attachments is confidential, and
may not
> be copied or used by anyone other than the addressee, nor disclosed to
any
> third party without our permission. There is no intention to create
any
> legally binding contract or other binding commitment through the use
of this
> electronic communication unless it is issued in accordance with the
Experian
> Limited standard terms and conditions of purchase or other express
written
> agreement between Experian Limited and the recipient. Although
Experian has
> taken reasonable steps to ensure that this communication and any
attachments
> are free from computer virus, you are advised to take your own steps
to
> ensure that they are actually virus free.
>
> Companies Act information: Registered name: Experian Limited.
Registered
> office: Landmark House, Experian Way, NG2 Business Park, Nottingham,
NG80
> 1ZZ, United Kingdom. Place of registration: England and Wales.
Registered
> number: 653331
>
>

**************************************************************************************
La informacion contenida en este mail es de caracter confidencial o para uso exclusivo
del Grupo TOYOTA DE VENEZUELA en sus procesos y actividades de negocio. Los puntos de 
vista u  opiniones  presentes  en  el mismo  son  responsabilidad  del  remitente y no 
representan una posicion formal del grupo TOYOTA DE VENEZUELA (TOYOTA DE VENEZUELA, C.A.
o TOYOTA INDUSTRIAL DE VENEZUELA, C.A.). Si  UD. no  es  el destinatario o  recibio  esta 
informacion por error, agradecemos destruirla de inmediato y notificar al remitente por
esta misma via, debido a que su copia, distribucion o uso esta reservado solo para
personas autorizadas.
***************************************************************************************
The information contained in this mail is strictly confidential or for the exclusive use
by TOYOTA DE VENEZUELA Group in its process and business activities. The points of view
or  present  opinions  contained  in the mail, are the senders responsibility and  dont
represent a formal opinion of TOYOTA DE VENEZUELA Group (TOYOTA  DE  VENEZUELA, C.A. or
TOYOTA INDUSTRIAL DE VENEZUELA, C.A.) If you are not the destined user or received this
information by mistake, we appreciate if you destroy  it  inmediately  and  notify  the
sender  by this same way, because its copying, distributing and use is allowed only for 
authorized people.


RE: JCR-SQL2 where clause is not working

Posted by "PALMER, THOMAS C (ATTCORP)" <TP...@att.com>.
Hey Alex -
I see the use of WHERE ISCHILDNODE... but is there a way to also assert
that the parent has a certain property value (in addition to my target
node meeting some criteria)?

Thanks!

-----Original Message-----
From: Alex Parvulescu [mailto:alex.parvulescu@gmail.com] 
Sent: Friday, April 01, 2011 6:09 AM
To: users@jackrabbit.apache.org
Cc: De Georges, Adrien
Subject: Re: JCR-SQL2 where clause is not working

Hi Adrien,

You can take a look here [1] to see how to build an SQL2 query involving
a
parent node.
Basically you should use ISCHILDNODE.

See [2] for the specs.

[1]
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/tes
t/java/org/apache/jackrabbit/core/query/FulltextSQL2QueryTest.java

[2] http://www.day.com/specs/jcr/2.0/6_Query.html#6.7.12 Constraint

best,
alex

On Fri, Apr 1, 2011 at 11:52 AM, De Georges, Adrien <
Adrien.DeGeorges@experian.com> wrote:

> Hi guys,
>
> We are using SQL queries to retrieve some nodes in the repository.
> And we are encountering some problem when using 'WHERE' clause as no
> element is found. We have other queries which are working correctly.
But
> it fails each time we use 'WHERE' with '=' or 'contains' ('is not
null'
> is working fine).
> Our query is quiet simple :
> Select * from nt:base WHERE PARENT_UUID = 'id'.
>
> Do you have any idea? Somebody is experiencing a same problem?
>
> Thanks
> Adrien
>
>
>
> Information in this e-mail and any attachments is confidential, and
may not
> be copied or used by anyone other than the addressee, nor disclosed to
any
> third party without our permission. There is no intention to create
any
> legally binding contract or other binding commitment through the use
of this
> electronic communication unless it is issued in accordance with the
Experian
> Limited standard terms and conditions of purchase or other express
written
> agreement between Experian Limited and the recipient. Although
Experian has
> taken reasonable steps to ensure that this communication and any
attachments
> are free from computer virus, you are advised to take your own steps
to
> ensure that they are actually virus free.
>
> Companies Act information: Registered name: Experian Limited.
Registered
> office: Landmark House, Experian Way, NG2 Business Park, Nottingham,
NG80
> 1ZZ, United Kingdom. Place of registration: England and Wales.
Registered
> number: 653331
>
>

Re: JCR-SQL2 where clause is not working

Posted by Alex Parvulescu <al...@gmail.com>.
Hi Adrien,

You can take a look here [1] to see how to build an SQL2 query involving a
parent node.
Basically you should use ISCHILDNODE.

See [2] for the specs.

[1]
http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/FulltextSQL2QueryTest.java

[2] http://www.day.com/specs/jcr/2.0/6_Query.html#6.7.12 Constraint

best,
alex

On Fri, Apr 1, 2011 at 11:52 AM, De Georges, Adrien <
Adrien.DeGeorges@experian.com> wrote:

> Hi guys,
>
> We are using SQL queries to retrieve some nodes in the repository.
> And we are encountering some problem when using 'WHERE' clause as no
> element is found. We have other queries which are working correctly. But
> it fails each time we use 'WHERE' with '=' or 'contains' ('is not null'
> is working fine).
> Our query is quiet simple :
> Select * from nt:base WHERE PARENT_UUID = 'id'.
>
> Do you have any idea? Somebody is experiencing a same problem?
>
> Thanks
> Adrien
>
>
>
> Information in this e-mail and any attachments is confidential, and may not
> be copied or used by anyone other than the addressee, nor disclosed to any
> third party without our permission. There is no intention to create any
> legally binding contract or other binding commitment through the use of this
> electronic communication unless it is issued in accordance with the Experian
> Limited standard terms and conditions of purchase or other express written
> agreement between Experian Limited and the recipient. Although Experian has
> taken reasonable steps to ensure that this communication and any attachments
> are free from computer virus, you are advised to take your own steps to
> ensure that they are actually virus free.
>
> Companies Act information: Registered name: Experian Limited. Registered
> office: Landmark House, Experian Way, NG2 Business Park, Nottingham, NG80
> 1ZZ, United Kingdom. Place of registration: England and Wales. Registered
> number: 653331
>
>