Re: String-with-number sort and insert order preservation

From: Marek Šab (msab..uk.cvut.cz)
Date: Wed Feb 03 2010 - 07:04:42 EST

  • Next message: Andrey Razumovsky: "Re: String-with-number sort and insert order preservation"

    Thank you all for your ideas, my progress:

    > 1) Is there any way to sort varchar fields which happen to numbers, more
    > precisely ipv4s?
    > query.addOrdering(Ip4Address.IP_ADDRESS_PROPERTY, SortOrder.ASCENDING);
    > This of course sets the hundreds as first in line, any tips on some
    > custom sorting?
    >
    I just implemented custom comparator and added the result list from
    query to treeset - anyway the IPs are unique.
    > 2) Is there any way how to override this mechanism in order to preserve
    > order of inserted rows?
    >
    >
    This one I can't really cope with. Of course I could fill it in ten
    other ways which will preserve the order of inserted rows, so really,
    haven't any of you ever needed or wanted the data to be indexed by
    auto-generated pk in order you add them to context while in persisting
    phase? Because that would nicely solve issue #1 as well because the IPs
    would be sorted according to pk. This is collateral functionality that's
    why it isn't designed as OOP would preach.

    Regards,

    Marek



    This archive was generated by hypermail 2.0.0 : Wed Feb 03 2010 - 07:05:25 EST