HQL query on DBTreeList

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HQL query on DBTreeList

pierrick.bena
Hi again !


I have several "Blog.BlogPostClass" objects and I try to make an HQL
query in order to get BlogPosts which belong to a particular category.

This is the category property of my objects :

<property type="DBTreeList" name="category">
<link rel="self"
href="http://192.168.11.34:8080/xwiki/rest/wikis/xwscomintech/spaces/Blog/pages/%20Tous%20vendeurs/objects/Blog.BlogPostClass/0/properties/category"/>
<attribute value="category" name="name"/><attribute value="Category"
name="prettyName"/>
<attribute value="0" name="unmodifiable"/>
<attribute value="0" name="disabled"/>
<attribute value="1" name="relationalStorage"/>
<attribute value="input" name="displayType"/>
<attribute value="1" name="multiSelect"/>
<attribute value="1" name="size"/>
<attribute value=", " name="separator"/>
<attribute value="0" name="cache"/>
<attribute value="Blog.CategoryClass" name="classname"/>
<attribute value="" name="customDisplay"/>
<attribute value="doc.fullName" name="idField"/>
<attribute value="4" name="number"/>
<attribute value="doc.parent" name="parentField"/>
<attribute value="1" name="picker"/>
<attribute value="" name="separators"/>
<attribute value="value" name="sort"/>
<attribute value="" name="sql"/>
<attribute value="" name="tooltip"/>
<attribute value="" name="validationMessage"/>
<attribute value="" name="validationRegExp"/>
<attribute value="name" name="valueField"/>
<attribute
value="Blog.Categories,Blog.CategoryTemplate,Blog.News,Blog.Other,Blog.Personal"
name="allowedValues"/>
<value>Blog.Réunions thématiques</value></property>

I would like to list BlogPosts in "Blog.Réunions thématiques"

I tried this query :

#set($hql = ", BaseObject as obj, DateProperty as prop1,
StringProperty as prop2 where doc.fullName=obj.name and
obj.className='Blog.BlogPostClass' and obj.id=prop1.id.id and
obj.id=prop2.id.id and prop2.id.name='category' and
prop2.value='Blog.Réunions thématiques' and prop1.id.name='publishDate'
and prop1.value is not null and doc.space='Blog' order by prop1.value
desc ")

I saw that the type of my property was "DBTreeList" so I tried to
replace StringProperty by DBStringListProperty but no success ...

I need help please :-)

Thanks

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: HQL query on DBTreeList

rrodriguezIDIS
Hi!

Why don't you consider to use XWQL instead? Find below a living example based on examples on this xwiki.org page...

http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module


http://www.idisantiago.es/bin/XWQL/BlogEntriesByCategory
http://www.idisantiago.es/bin/XWQL/BlogEntriesByCategory?viewer=code


HTH!

Ricardo

________________________________________
From: [hidden email] [[hidden email]] On Behalf Of [hidden email] [[hidden email]]
Sent: 24 May 2013 16:13
To: [hidden email]
Subject: [xwiki-users] HQL query on DBTreeList

Hi again !


I have several "Blog.BlogPostClass" objects and I try to make an HQL
query in order to get BlogPosts which belong to a particular category.

This is the category property of my objects :

<property type="DBTreeList" name="category">
<link rel="self"
href="http://192.168.11.34:8080/xwiki/rest/wikis/xwscomintech/spaces/Blog/pages/%20Tous%20vendeurs/objects/Blog.BlogPostClass/0/properties/category"/>
<attribute value="category" name="name"/><attribute value="Category"
name="prettyName"/>
<attribute value="0" name="unmodifiable"/>
<attribute value="0" name="disabled"/>
<attribute value="1" name="relationalStorage"/>
<attribute value="input" name="displayType"/>
<attribute value="1" name="multiSelect"/>
<attribute value="1" name="size"/>
<attribute value=", " name="separator"/>
<attribute value="0" name="cache"/>
<attribute value="Blog.CategoryClass" name="classname"/>
<attribute value="" name="customDisplay"/>
<attribute value="doc.fullName" name="idField"/>
<attribute value="4" name="number"/>
<attribute value="doc.parent" name="parentField"/>
<attribute value="1" name="picker"/>
<attribute value="" name="separators"/>
<attribute value="value" name="sort"/>
<attribute value="" name="sql"/>
<attribute value="" name="tooltip"/>
<attribute value="" name="validationMessage"/>
<attribute value="" name="validationRegExp"/>
<attribute value="name" name="valueField"/>
<attribute
value="Blog.Categories,Blog.CategoryTemplate,Blog.News,Blog.Other,Blog.Personal"
name="allowedValues"/>
<value>Blog.Réunions thématiques</value></property>

I would like to list BlogPosts in "Blog.Réunions thématiques"

I tried this query :

#set($hql = ", BaseObject as obj, DateProperty as prop1,
StringProperty as prop2 where doc.fullName=obj.name and
obj.className='Blog.BlogPostClass' and obj.id=prop1.id.id and
obj.id=prop2.id.id and prop2.id.name='category' and
prop2.value='Blog.Réunions thématiques' and prop1.id.name='publishDate'
and prop1.value is not null and doc.space='Blog' order by prop1.value
desc ")

I saw that the type of my property was "DBTreeList" so I tried to
replace StringProperty by DBStringListProperty but no success ...

I need help please :-)

Thanks

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users

Nota: A información contida nesta mensaxe e os seus posibles documentos adxuntos é privada e confidencial e está dirixida únicamente ó seu destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos adjuntos es privada y confidencial y está dirigida únicamente a su destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso_confidencialidad.htm
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
--
Ricardo Rodríguez
Research Management and Promotion Technician
Technical Secretariat
Health Research Institute of Santiago de Compostela (IDIS)
http://www.idisantiago.es
Reply | Threaded
Open this post in threaded view
|

Re: HQL query on DBTreeList

pierrick.bena
Thanks Ricardo, it solved my problem :-)

Regards
Pierrick

On Fri, 24 May 2013 18:02:13 +0200,
<[hidden email]> wrote:

> Hi!
>
> Why don't you consider to use XWQL instead? Find below a living
> example based on examples on this xwiki.org page...
>
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module
>
>
> http://www.idisantiago.es/bin/XWQL/BlogEntriesByCategory
> http://www.idisantiago.es/bin/XWQL/BlogEntriesByCategory?viewer=code
>
>
> HTH!
>
> Ricardo
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of
> [hidden email] [[hidden email]]
> Sent: 24 May 2013 16:13
> To: [hidden email]
> Subject: [xwiki-users] HQL query on DBTreeList
>
> Hi again !
>
>
> I have several "Blog.BlogPostClass" objects and I try to make an HQL
> query in order to get BlogPosts which belong to a particular category.
>
> This is the category property of my objects :
>
> <property type="DBTreeList" name="category">
> <link rel="self"
> href="http://192.168.11.34:8080/xwiki/rest/wikis/xwscomintech/spaces/Blog/pages/%20Tous%20vendeurs/objects/Blog.BlogPostClass/0/properties/category"/>
> <attribute value="category" name="name"/><attribute value="Category"
> name="prettyName"/>
> <attribute value="0" name="unmodifiable"/>
> <attribute value="0" name="disabled"/>
> <attribute value="1" name="relationalStorage"/>
> <attribute value="input" name="displayType"/>
> <attribute value="1" name="multiSelect"/>
> <attribute value="1" name="size"/>
> <attribute value=", " name="separator"/>
> <attribute value="0" name="cache"/>
> <attribute value="Blog.CategoryClass" name="classname"/>
> <attribute value="" name="customDisplay"/>
> <attribute value="doc.fullName" name="idField"/>
> <attribute value="4" name="number"/>
> <attribute value="doc.parent" name="parentField"/>
> <attribute value="1" name="picker"/>
> <attribute value="" name="separators"/>
> <attribute value="value" name="sort"/>
> <attribute value="" name="sql"/>
> <attribute value="" name="tooltip"/>
> <attribute value="" name="validationMessage"/>
> <attribute value="" name="validationRegExp"/>
> <attribute value="name" name="valueField"/>
> <attribute
> value="Blog.Categories,Blog.CategoryTemplate,Blog.News,Blog.Other,Blog.Personal"
> name="allowedValues"/>
> <value>Blog.Réunions thématiques</value></property>
>
> I would like to list BlogPosts in "Blog.Réunions thématiques"
>
> I tried this query :
>
> #set($hql = ", BaseObject as obj, DateProperty as prop1,
> StringProperty as prop2 where doc.fullName=obj.name and
> obj.className='Blog.BlogPostClass' and obj.id=prop1.id.id and
> obj.id=prop2.id.id and prop2.id.name='category' and
> prop2.value='Blog.Réunions thématiques' and prop1.id.name='publishDate'
> and prop1.value is not null and doc.space='Blog' order by prop1.value
> desc ")
>
> I saw that the type of my property was "DBTreeList" so I tried to
> replace StringProperty by DBStringListProperty but no success ...
>
> I need help please :-)
>
> Thanks
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users
>
> Nota: A información contida nesta mensaxe e os seus posibles
> documentos adxuntos é privada e confidencial e está dirixida
> únicamente ó seu destinatario/a. Se vostede non é o/a destinatario/a
> orixinal desta mensaxe, por favor elimínea. A distribución ou copia
> desta mensaxe non está autorizada.
>
> Nota: La información contenida en este mensaje y sus posibles
> documentos adjuntos es privada y confidencial y está dirigida
> únicamente a su destinatario/a. Si usted no es el/la destinatario/a
> original de este mensaje, por favor elimínelo. La distribución o copia
> de este mensaje no está autorizada.
>
> See more languages: http://www.sergas.es/aviso_confidencialidad.htm
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users