Can Hibernate return a collection of result objects OTHER than a List?

后端 未结 4 1823
無奈伤痛
無奈伤痛 2020-12-11 22:17

Does the Hibernate API support object result sets in the form of a collection other than a List?

For example, I have process that runs hundreds of thousands of iter

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-11 22:39

    Yes, that can be done.

    However, you'll probably have to have your domain class implement Comparable; I don't think you can do it using a Comparator.

    Edit: It seems like I misunderstood the question. If you're talking about the result of an ad hoc query, then the above will not help you. It might be possible to make it work by binding an object with a TreeMap property to a database view if the query is fixed.

    And of course you can always build the map yourself with very little work and processing overhead.

提交回复
热议问题