cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marek Ĺ abo <>
Subject Re: String-with-number sort and insert order preservation
Date Wed, 03 Feb 2010 12:04:42 GMT
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.



View raw message