hibernate query list: empty or null?

kuba44 picture kuba44 · Nov 10, 2014 · Viewed 13.7k times · Source

If I have method which use Hibernate, like this:

public <T> T typedQuery(Query q, Class<T> type) {
    List<T> results = q.list();

    //result will be null or empty List ?
}

If query won't get any record from table, result will be null or empty List?

Answer

Predrag Maric picture Predrag Maric · Nov 10, 2014

It will return an empty list, if there are no results. Relevant post