加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – Hibernate的批量获取算法如何工作?

发布时间:2020-12-15 00:50:11 所属栏目:Java 来源:网络整理
导读:我在“Manning- Java Persistence with Hibernate”中找到了批量获取算法的描述: What is the real batch-fetching algorithm? (…) Imagine a batch size of 20 and a total number of 119 uninitialized proxies that have to be loaded in batches. At s
我在“Manning- Java Persistence with Hibernate”中找到了批量获取算法的描述:

What is the real batch-fetching
algorithm? (…) Imagine a batch size of
20 and a total number of 119
uninitialized proxies that have to be
loaded in batches. At startup time,
Hibernate reads the mapping metadata
and creates 11 batch loaders
internally. Each loader knows how many
proxies it can initialize: 20,10,9,
8,7,6,5,4,3,2,1. The goal is to
minimize the memory consumption for
loader creation and to create enough
loaders that every possible batch
fetch can be produced. Another goal is
to minimize the number of SQL
SELECTs,obviously. To initialize 119
proxies Hibernate executes seven
batches (you probably expected six,
because 6 x 20 > 119). The batch
loaders that are applied are five
times 20,one time 10,and one time 9,
automatically selected by Hibernate.

但我仍然不明白它是如何工作的.

>为什么11批装载机?
>为什么批量加载器可以初始化:20,8,1代理?

如果有人可以提出一步一步的算法……

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读