Hi Artem,

Now it works! Another SVN update this morning fixed it. Thank you very much 
for your help!


----- Original Message ----- 
From: "Artem Melentyev" <[EMAIL PROTECTED]>
To: "XWiki Developers" <[email protected]>
Sent: Tuesday, July 29, 2008 9:46 PM
Subject: [gsoc] Re: [xwiki-devs] Problems creating a query using the 
QueryManager


> Hi, Markus.
>
> I tired it and it work fine for me.
>
> I created XWiki.OpenIdIdentifier class with StringProperty field. Added
> it to XWiki.Admin user page (identifier='someurl') and used this groovy
> script inside xwiki page for test:
> <%
> println xwiki.xWiki.store.queryManager.createQuery("select doc.fullName"
> +" from XWikiDocument as doc, BaseObject as obj, StringProperty as prop"
> +" where doc.fullName = obj.name and obj.className =
> 'XWiki.OpenIdIdentifier' "
> +" and obj.id=prop.id.id and prop.id.name='identifier' and prop.value =
> :identifier", "hql").bindValue("identifier", "someurl").execute()
> %>
> named query also works for me.
>
> I recently commit some fix for hibernate queries. Maybe it will fix your
> problem. Please svn up and try again.
>
> Try also old XWikiStoreInterface#search* methods if QueryManager will
> not work.
>
> Markus Lanthaler wrote:
>> Sorry for the late answer but I had problems with my installation after 
>> the
>> SVN update.
>> Now I don't get any exception anymore - but also no result. I tried both,
>> creating a named query by adding the following code to queries.hbm.xml 
>> and
>> creating the query directly.
>>
>>   <query name="getUserDocByOpenIdIdentifier">
>>     select doc.fullName from XWikiDocument as doc, BaseObject as obj,
>> StringProperty as prop where doc.fullName=obj.name and
>> obj.className='XWiki.OpenIdIdentifier' and obj.id=prop.id.id and
>> prop.id.name='identifier' and prop.value=:identifier
>>   </query>
>>
>> This sets the statement member in the returned query
>> qm.getNamedQuery("getUserDocByOpenIdIdentifier") to
>> "getUserDocByOpenIdIdentifier". Is that right!?
>>
>> I tried also to create the query directly (also including "select
>> doc.fullName"):
>>
>> Query search_user2 = qm.getNamedQuery("getUserDocByOpenIdIdentifier");
>> search_user2 = qm.createQuery("from XWikiDocument as doc, BaseObject as 
>> obj,
>> StringProperty as prop where doc.fullName = obj.name and obj.className =
>> 'XWiki.OpenIdIdentifier' and obj.id=prop.id.id and 
>> prop.id.name='identifier'
>> and prop.value = :identifier", Query.HQL);
>>
>> search_user2.bindValue("identifier", openid_identifier);
>>
>> List<XWikiDocument> found_users2 = search_user2.setLimit(1).execute();
>> if (found_users2.size() > 0) {
>>   return found_users2.get(0).getFullName();
>> }
>>
>>
>> Both queries returned empty lists.
>>
>> I checked the DB with the MySQL Query Browser and saw that there are the
>> right entries in xwikistrings, xwikiobjects and xwikidoc so they are 
>> saved
>> in the right way. Are the table names converted automatically? There is 
>> no
>> table XWikiDocument in my DB but just xwikidoc for instance.
>
> Hibernate automatically transform class names to its db tables.
> Look xwiki.hbm.xml for mapping.
>
>>...
>
>
> -- 
>   Artem Melentyev
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
> 

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to