Search code examples
javahibernatelistnulljpql

hibernate query list: empty or null?


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?


Solution

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