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

后端 未结 4 1820
無奈伤痛
無奈伤痛 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:57

    I assume you are referring to the Query.list() method. If so: no, there is no way to return top-level results other than a List. If you are receiving too many results, why not issue a more constrained query to the database? If the query is difficult to constrain, you can populate your own Map with the contents of Hibernate's List and then throw away the list.

提交回复
热议问题