You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by "Dmitriy S. Romanov" <dr...@softline.kiev.ua> on 2004/03/31 18:40:33 UTC

EnhancedQueryOQL.fullSize

Hello, All!

I'm using paging queries from ODMG. The only way is to call EnhancedQueryOQL.fullSize() after OQLQuery.execute(),
 fullSize() but it is now deprecated and returns always zero.
As I find out in javadoc for org.apache.ojb.broker.query.Query.fullSize():

/**
     * @deprecated use OJBIterator.fullSize()
     * @return
     */
int fullSize();

But I don't see a way to reach OJBIterator from ODMG level, so I've patched PersistenceBrokerImpl to save
info about fullSize in Query for passing it to EnhancedOQLQuery:

protected OJBIterator getIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException
    {
        RsIteratorFactory factory = RsIteratorFactoryImpl.getInstance();
        OJBIterator result = getRsIteratorFromQuery(query, cld, factory);

        if (query.usePaging())
        {
            result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex());
            query.fullSize(result.fullSize()); // here is my patch
           //^^^^^^^^^^^^^^^^^^^^^^^
        }

        return result;
    }

See diff result on fresh updated version of  PersistenceBrokerImpl.java:

[root@inetcvs dromanov]# diff PersistenceBrokerImpl.java PersistenceBrokerImpl_patched.java
1325a1326
>             query.fullSize(result.fullSize());

Committers, please apply this patch or someone advise me how to work with paging queries without on ODMG level 
using deprecated methods.

--
Dmitriy S. Romanov
mailto:rds@astral.ntu-kpi.kiev.ua;dromanov@softline.kiev.ua
ICQ# 52449008

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org