Recently, If you are using Hibernate 5.2 or higher, then the Query::list() method has been deprecated.
Now, what the difference in using these two methods?
If anyone knows, please explain with examples.
Recently, If you are using Hibernate 5.2 or higher, then the Query::list() method has been deprecated.
Now, what the difference in using these two methods?
If anyone knows, please explain with examples.
The documentation of Hibernate 3.2 says that Query#list() returns the query as List<T>.
Return the query results as a List. If the query contains multiple results pre row, the results are returned in an instance of Object[].
As you can read from the newer documentation of Hibernate 5.2 about the same named class and its method Query#getResultList is the overridden implementation of the the javax interface's method TypedQuery#getResultList.
Execute a SELECT query and return the query results as a typed List.
This method is a replacement of the one from the previous versions.
The idea is to implement Java EE interface (most of javax library) and keep the naming consistent.