Can javax.persistence.Query.getResultList() return null?

后端 未结 7 1849
心在旅途
心在旅途 2020-12-02 15:19

And if so, under what circumstances?

Javadoc and JPA spec says nothing.

相关标签:
7条回答
  • 2020-12-02 15:45

    Contrary to Arthur's post, when I actually ran a query which no entities matched I got an empty list, not null. This is using Hibernate and is what I consider correct behaviour: an empty list is the correct answer when you ask for a collection of entities and there aren't any.

    0 讨论(0)
提交回复
热议问题