Hi Dave,

You asked if null should be universally "less than" non-null.

No, everyone thinks differently.

For us it is the opposite. We use Oracle and like the way it sorts. We 
want "null" to be greater than "non-null". That is because for our domain 
we want to see values that have something "in them" first and for those 
with interesting values to be sorted ascending. "Empty" values should be 
at the end of the list.

We use Oracle and left it alone. We decided to "fix" WO by making a 
"NullsAtEndComparisonSupport" class and then at application startup use a 
line like so:

EOSortOrdering.ComparisonSupport.setSupportForClass(new 
NullsAtEndComparisonSupport(), Object.class);
EOSortOrdering.ComparisonSupport.setSupportForClass(new 
NullsAtEndComparisonSupport(), String.class);

Note 1: We had to do those lines "after" invoking "
ERXLocalizer.currentLocalizer();"

In summary, it doesn't matter if you "fix" the DB or you fix the in-memory 
sorting as we have done. What matters is that you realize there can be 
differences and you have full control over how you want sorting to work no 
matter what DB you use.

Cheers,
-- Aaron


> Is there general consensus that the way sorting _should_ work 
> is that null is considered to be less-than non-null?
>
> 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/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to