Hi all,

I have the following the code:

                QueryManager qm = jcrSession.getWorkspace().getQueryManager();

                String queryString =    "select * from [my:order] as order " +
                                                                "left outer 
join [my:orderItem] as orderElement on
orderElement.[orderUUID] = order.[jcr:uuid] " + 
                                                                "left outer 
join [my:product] as product on
orderElement.[productUUID] = product.[jcr:uuid] " +
                                                                "where 
product.[providerUUID]='" + providerUUID + "' " +
                                                                "order by 
order.[jcr:created] asc";
                                                
                Query query = qm.createQuery(queryString, Query.JCR_SQL2); 
                QueryResult queryResult = query.execute();

                NodeIterator nodeIterator = queryResult.getNodes();

                long totalSize = nodeIterator.getSize();
                int anotherTotalSize = 
((QueryResultImpl)queryResult).getTotalSize();

totalSize and anotherTotalSize both equal -1 even though I specify an order
by clause.  As far as I understood, specifying an order by clause should
cause the full result set to load and nodeIterator.getSize() should not read
-1.  In an example, I later iterate over the nodeIterator and it has three
my:order nodes, so getSize should be 3.

Does anyone know why getSize is returning -1 in this case?

Is there a quicker way to get the size of the result set?  Perhaps iterate
through the nodeIterator and do my own count?

Thanks and kind regards,

James
-- 
View this message in context: 
http://n4.nabble.com/NodeIterator-getSize-returns-1-for-query-with-order-by-clause-tp1839436p1839436.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Reply via email to