org.hibernate.Query中的setMaxResults和setFetchSize有什么区别? [英] What is difference between setMaxResults and setFetchSize in org.hibernate.Query?

查看:195
本文介绍了org.hibernate.Query中的setMaxResults和setFetchSize有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

org.hibernate.Query中的 setMaxResults setFetchSize 有什么区别?我只是不能得到它=)

解决方案

setMaxResults 是相同的作为 LIMIT 在SQL中,您设置要返回的最大行数。当然,这是一个非常常见的用例。

setFetchSize 是关于优化,这可以改变Hibernate如何将结果发送给调用者(例如:以不同大小的块缓冲)。
setFetchSize 不是由所有数据库驱动程序实现的。

What is difference between setMaxResults and setFetchSize in org.hibernate.Query? I just can no get it =)

解决方案

setMaxResults is the same as LIMIT in SQL- you are setting the maximum number of rows you want returned. This is a very common use case of course.

setFetchSize is about optimization, which can change how Hibernate goes about sending the results to the caller (example: buffered, in different size chunks). setFetchSize is NOT implemented by all database drivers.

这篇关于org.hibernate.Query中的setMaxResults和setFetchSize有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆