Menu

#3 Support sorting

open
nobody
None
3
2008-01-21
2008-01-21
TimJowers
No

Need a Comparator or to implement Comparable for Collections.sort.

I'm guessing this is for the order in a display. If so, I've run into this problem too... but not solved it yet. I'm not sure where sorting needs to fit. I've tried setting an ORDER BY in the DAO and that works OK. I think putting an ordering column in the table makes sense, especially for one other project I'm doing. Off the top of my head I'm thinking maybe of generating Comparators separate from the DTO. Then one can pass the Comparator to use into the Collections.sort; so, one can choose to compare on any column. This might make sense since we know from the db what the db type is so can generate accurate comparison code but we do not know what column the user wants to use.

Thoughts on how best to support sorting?

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.