Reputation: 145
I have this JdbcPagingItem reader and I want to sort by 2 columns.
Map<String, Order> sortKey = new HashMap<>();
sortKey.put("xbin", Order.ASCENDING);
sortKey.put("ybin", Order.ASCENDING);
Since the sortKey is a Map, I think this should work.
I need some confirmation if this is how I am supposed to do?
thx, Markus.
Upvotes: 0
Views: 1031
Reputation: 31600
Yes, you can sort items by multiple columns and your code snippet is correct. The resulting query performed by the item reader will be something like:
select ... from table .. ORDER BY xbin ASC, ybin ASC
Upvotes: 1