setMaxResults has the same effect on the query as it does LIMITin SQL , that is, it limits the maximum number of rows that the query returns.
setFetchSize has more to do with optimization, since it allows you to tell Hibernate how to return the data in blocks of information (all the records at once, or blocks of n records as we need to access the data). Note that setFetchSizeit is not implemented for all database drivers.
setMaxResults has the same effect on the query as it does
LIMIT
in SQL , that is, it limits the maximum number of rows that the query returns.setFetchSize has more to do with optimization, since it allows you to tell Hibernate how to return the data in blocks of information (all the records at once, or blocks of n records as we need to access the data). Note that
setFetchSize
it is not implemented for all database drivers.You can see the original answer here