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

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

And if so, under what circumstances?

Javadoc and JPA spec says nothing.

7条回答
  •  无人及你
    2020-12-02 15:29

    If you take a close look at the org.hibernate.loader.Loader (4.1) you will see that the list is always initialized inside the processResultSet() method (doc, source).

    protected List processResultSet(...) throws SQLException {
       final List results = new ArrayList();
    
       handleEmptyCollections( queryParameters.getCollectionKeys(), rs, session );
       ...
       return results;
    
    }
    

    So I don't think it will return null now.

提交回复
热议问题