You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Florian Müller <fm...@apache.org> on 2013/10/08 10:33:11 UTC

Re: QueryResult.getTotalNumItems() reporting 2 when there is only 1 result as expected

 Hi Mark,

 That is weird because the CMIS Workbench and your code snippet use the 
 same OpenCMIS code to execute the query.
 Would it be possible to record the requests and responses of the CMIS 
 Workbench and your code? That would help locating the issue.


 - Florian


> Chemistry folks
>
> We are running into an odd issue where a CMIS Query run via the 
> Chemistry
> Workbench returns 1 record *as expected* but when the EXACT same CMIS 
> SQL
> is executed in code, the call to the method 
> QueryResult.*getTotalNumItems*()
> is returning 2.  This is of course causing problems as it is expected 
> in
> this particular use case to return either 0 or 1 only.
>
> The code to process the query is done like this:
>
>             QueryStatement queryStatement =
> cmisServices.getCmisSession().createQueryStatement(query);
>             queryStatement.setString(1, parentFolder1);
>             queryStatement.setString(2, childFolder1); // look for 
> target
> folder within the tree...
>
>             ItemIterable<QueryResult> queryResult =
> queryStatement.query(false).getPage(500);
>
> The queryStatement String (with bound values) looks like this:
>
> SELECT * FROM cmis:folder WHERE
> 
> IN_TREE('workspace://SpacesStore/2ba621d5-d8ad-4cd2-bdf4-b0e9a64a170e') 
> AND
> cmis:name= 'ABC124DEF456'
>
>
>
>    - Chemistry Workbench returns: 1  - CORRECT
>    - CMIS  Node Browser in Alfresco 4.1.4 returns: 1 - CORRECT
>    - Coded test program results in this statement below returning: *2 
> -
>    INCORRECT*
>
>
>                LOGGER.info("***queryResult.getTotalNumItems() " +
> queryResult.getTotalNumItems());
>
> Running with Apache Chemistry 0.8.0 and Alfresco Enterprise 4.1.4  
> and
> using the CMIS AtomPuib binding
>
>
> Is it possible that this is a bug we've hit being on the Chemistry 
> 0.8.0
> RELEASE?
>
> Thanks
>
> Mark