Re: Adding own ordering algorithm

From: Juergen Saar (juerge..saar.org)
Date: Sun Nov 16 2008 - 13:57:34 EST

  • Next message: Robert Zeigler: "Re: Include modeler.bat back in the distribution?"

    The 'normal' way of ordering is done by database.

    In your special case there is problem in database-design,
    not in the ordering itself.

    There should be 3 columns in database to get a perfect ordering.

    The other way is ordering with the java classes for ordered maps,
    there you can write your own Comparator,
    but this way should only be choosen on small result lists.

    The third way is to create a view in database,
    where this field is reformatted so that it can
    be used for 'order by'.

    So I think this is not a cayenne-problem ...
    - Juergen -

    2008/11/16 Adrian Wiesmann <awiesman..omap.org>

    > Hello all
    >
    > I have a field in a DataObject which I need for ordering and which is
    > formatted like this:
    >
    > <number>.<number>.<number>
    >
    > When ordering with the default Java order mechanism this problem arises.
    > The numbers are ordered like that (which is wrong in this context):
    >
    > 10.10.10
    > 10.4.10
    > 10.9.10
    >
    > So I need to write my own comparator. Has anybody done so with Cayenne
    > before and what would you declare as the best/cleanest solution to do so?
    > Subclassing Ordering, extending the compare method and use that new class?
    >
    > Thanks for your comments.
    >
    > Cheers,
    > Adrian
    >



    This archive was generated by hypermail 2.0.0 : Sun Nov 16 2008 - 13:58:20 EST