Hi Mike,

Almost perfect. Following your example, here's what I came up with: (patch to 
follow in Jira)

    @Override
    public void addOrderByAttributeOrdering(EOSortOrdering sortOrdering) {
        super.addOrderByAttributeOrdering(sortOrdering);
        if (sortOrdering.selector() == 
EOSortOrdering.CompareCaseInsensitiveDescending
                || sortOrdering.selector() == EOSortOrdering.CompareDescending) 
{
            _orderByString().append(" NULLS LAST"); // Oracle's Default
        } else {
            _orderByString().append(" NULLS FIRST");
        }
    }

Dave

On Jan 8, 2010, at 10:36 AM, Mike Schrag wrote:

> maybe try something like (completely untested):
> 
>         public void addOrderByAttributeOrdering(EOSortOrdering sortOrdering) {
>               super. addOrderByAttributeOrdering(sortOrdering);
>               _orderByString().append(" NULLS FIRST");
>       }
> 
> On Jan 8, 2010, at 10:20 AM, David Avendasora wrote:
> 
>> Hi all,
>> 
>> This has taken me a while to track down, and I just want to make sure I've 
>> figured it out correctly, and if so, what the possible solutions are.
>> 
>> Oracle sorts null values to the end, so ORDER BY FIRST_NAME returns:
>> 
>> Anjo
>> Chunk
>> Mike
>> Null
>> 
>> EOSortOrdering sorts null values to the begining, so NAME.ascs() returns:
>> Null
>> Anjo
>> Chunk
>> Mike
>> 
>> Which does some really crazy things to ERXBatchingDisplayGroup. 
>> 
>> Let's say I have 100 rows in the DG. All the Name attributes are null, 
>> except for those three.
>> 
>> First the DB selects all the records and sorts them with nulls last, then 
>> gets the first 10 ids :
>> 
>>      select * from (select NAME, rownum eo_rownum from (SELECT t0.NAME FROM 
>> PEOPLE t0 ORDER BY t0.NAME ASC)) where eo_rownum between 1 and 10 
>> 
>> The results will be: Anjo, Chunk, Mike, null, null, null, null, null, null, 
>> null.
>> 
>> Then EOF sorts the array again, so the DG displays: null, null, null, null, 
>> null, null, null, Anjo, Chunk, Mike and all the subsequent batches will be 
>> full of nulls.
>> 
>> If this interpretation is correct, am I the first to run into this with 
>> Oracle?
>> 
>> I've been digging through the EROraclePlugin, and I figured adding this to 
>> the EROracleExpression class would fix it, but it doesn't:
>> 
>>     @Override
>>     protected void appendItemToOrderByString(String sqlString) {
>>         appendItemToListString(sqlString + " NULLS FIRST",
>>                                _orderByString());
>>     }
>> 
>> Anyone have any other suggestions?
>> 
>> Thanks,
>> 
>> Dave
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com
>> 
>> This email sent to [email protected]
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to