Walking thru the net I found this nice hint…
There is a way to sort the ldap query results. 389 (and some other
LDAP servers) have a functionality called server-side sorting.
You can set a special LDAP control while making your ldap query.
This control has a certain number of parameters, for example, which attributes
should be used for sorting and in which order you want your results to
Be careful with the performance implications, be sure that
your search result is small enough.
Some more details are available here :