hi robert,
there are three important steps that could affect sort order:
1.) the prefetched collection is sorted if the CollectionDescriptor defines an 'orderby'.
2.) CollectionDescriptor#associateBatched where ownerIdsToLists is initialized with a temporary ArrayList for each owner.
3.) CollectionDescriptor#associateBatched where the final collection (based on collectionClass)is created for the owner.
Steps 1.) and 2.) are imo ok. the sql contains an order by and ArrayList also maintains the order.
The problem is in step 3.) how could we warn the user that his list may cause sorting problems ?
jakob
Robert S. Sfeir schrieb:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote:
hi robert,
i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy that uses the orderby attribute of the CollectionDescriptor.
this test passes without any problems.
The only potential problem i see is in ColllectionPrefetcher#associateBatched().
...
else
{
ManageableCollection col = createCollection(collectionClass);
for (Iterator it2 = list.iterator(); it2.hasNext();)
{
col.ojbAdd(it2.next());
}
result = col;
}
...
if the collectionClass of CollectionDescriptor does not maintain the order the we have a problem.
Yup that looks like it, I use ManageableCollection, specifically the Set impl but changed to ArrayList impl, it's relying on the Collection to maintain its natural order, hence if the Collection is not sortable, it just adds them as it gets them. (at least this is what I understand from the code). Something has to happen there to tell the user they're full of it, and that you can't sort.
R -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ kIUY2hDxVeTCadrHpy7KNbI= =BiF0 -----END PGP SIGNATURE-----
--------------------------------------------------------------------- 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]
