抓取策略
1、hibernate抓取策略(单端代理的批量抓取)(抓取当前对象关联实体或集合):保持默认,同fetch="select",如:
<many-to-one name="classes" column="classesid" fetch="select"/>fetch="select",另外发送一条select语句抓取当前对象关联实体或集合
<many-to-one name="classes" column="classesid" fetch="join"/>
<set name="students" inverse="true" cascade="all" fetch="select">fetch="select",另外发送一条select语句抓取当前对象关联实体或集合
<set name="students" inverse="true" cascade="all" fetch="join">fetch="join",hibernate会通过select语句使用外连接来加载其关联实体或集合,此时lazy会失效
<set name="students" inverse="true" cascade="all" fetch="subselect">fetch="subselect",另外发送一条select语句抓取在前面查询到的所有实体对象的关联集合
<class name="Classes" table="t_classes" batch-size="3">
<set name="students" inverse="true" cascade="all" batch-size="5">