如何在java中对ResultSet进行排序? [英] How can I sort ResultSet in java?
本文介绍了如何在java中对ResultSet进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不能在数据库中按顺序执行ORDER BY
I can't do ORDER BY in the db by the way
推荐答案
将数据从ResultSet移到任何地方您想要的对象表示,然后对数据进行排序,就像您在此时的任何其他数据一样。
Move the data out of the ResultSet into whatever object representation you want and then sort the data just as you would any other data at that point.
如果您使用Collections.Sort对复杂的数据执行排序你将需要实现的对象比较者 。
If you make use of Collections.Sort to perform your sorting on a complex object you will need to implement Comparator.
这篇关于如何在java中对ResultSet进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文