atwhelan
atwhelan

Reputation: 25

org.hibernate.query.Query.list deprecated

I'm using SessionFactory (hibernate specific) methods.

org.hibernate.query.Query.list is deprecated. What is the non deprecated way to obtain results from a hibernate query? I can't believe I'm having this difficult a time trying to find this :)

For example:

<UploadStatus> query = session.createQuery("select us from UploadStatus us where us.uploadFileId = :uploadFileId")
    .setParameter("uploadFileId", fileUploadId); code here
 List<UploadStatus> us = query.list();

The list() method above is deprecated. What is the proper/non deprecated replacement for this?

Thanks -Andrew

Upvotes: 2

Views: 3550

Answers (1)

vijayanand
vijayanand

Reputation: 238

Use getResultList() method instead of list(). The getResultList() is declared in both TypedQuery and org.hibernate.Query (depricated) interfaces. The default implementation of getResultList() in org.hibernate.Query calls the list() method. But since its also declared in TypedQuery, I guess editor shouldn't show is as depricated.

Upvotes: 2

Related Questions