Actually, all addGroupBy and addOrderBy methods in Criteria object have already been deprecated since RC2 and replaced by the corresponding methods in the Query object...

-- Ilkka


Janssen, Roger wrote:
Hi,


personally I'm very busy with other OJB stuff and Jakob the query-guru is on vacation (and I don't have experience with the query code). So each patch is welcome, otherwise we have to wait till the guru is back ;-)


regards,
Armin



i may not have time for a patch either (if i come up with one i will mail it), but i have a workaround.

Part of the problem exists because OJB allows to set the 'orderBy' on a
Criteria object. This object (and nested Criteria objects) will later be
used building the Query. It would be best NOT to use criteria to set the
'orderBy' on.


After defining the criteria, build the query (using one of the 'Query....'
methods on PersistenceBroker, then set the orderBy with the relevant method
of the Query instance (QueryByCriteria has such a method).


This way, you can first build and execute the query to retrieve the data.
After that, if you need the fullsize, you can build the query again, do not
set the orderBy and use the getCount method of the PersistenceBroker to
calculate the fullsize yourselves (RsIterator e.a. use the same getCount
method as well).

When retrieving a Collection, the 'size' attribute is correctly populated.
When retrieving an iterator, you have to iterate yourselves over the
resultset to build a new collection/iterator anyway because you have to
release the resources, so during the iteration you can count the items and
you have the size, so you won't need the method-call to the size-method of
the OJBIterator object, nor will you need to execute a query.

This workaround seems to work fine...


I have a few pressing deadlines (will probably be using rc6 in several new upcoming releases of our products), but when i can find the time, i will try to create a patch. Although i think part of the patch may be to remove the addOrderBy and addGroupBy from the Criteria class. I myself do not know if this is the direction the query guru is heading for ... :)


Roger Janssen iBanx


*************************************************************************
The information contained in this communication is confidential and is
intended solely for the use of the individual or entity to whom it is
addressed.You should not copy, disclose or distribute this communication without the authority of iBanx bv. iBanx bv is neither liable for the proper and complete transmission of the information has been maintained
nor that the communication is free of viruses, interceptions or interference.


If you are not the intended recipient of this communication please return
the communication to the sender and delete and destroy all copies.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

.




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to