隨筆-124  評論-49  文章-56  trackbacks-0

          抓取策略(單端代理的批量抓取)
          1 保持默認,也就是fetch="select"
            <many-to-one name="classes" column="classesid" cascade="save-update"/>
            fetch="select",另外發(fā)送一條select語句抓取當(dāng)前對象關(guān)聯(lián)實體或集合
          2 設(shè)置fetch="jion"
            <many-to-one name="classes" column="classesid" cascade="save-update" fetch="join"/>
            fetch="jion",hibernate會通過select語句會使用外聯(lián)接來加載其關(guān)聯(lián)實體或集合,此時lazy會失效
          ------------------------------------------------------------
          抓取策略(集合代理的批量抓取)
          1 保持默認,也就是fetch="select"
            <set name="students" fetch="select">
            fetch="select",另外發(fā)送一條select語句抓取當(dāng)前對象關(guān)聯(lián)實體或集合
          2 設(shè)置fetch="jion"
            <set name="students" fetch="jion">
            fetch="jion",hibernate會通過select語句會使用外聯(lián)接來加載其關(guān)聯(lián)實體或集合,此時lazy會失效
          3 設(shè)置fetch="subselect"
            <set name="students" fetch="subselect">
            fetch="subselect",用于createQuery()查詢,另外發(fā)送一條select語句抓取在前面查詢到的所有實體對象的關(guān)聯(lián)集合
          ----------------------------------------------------------------
          抓取策略,batch-size在<class>上的應(yīng)用

          batch-size屬性,可能批量加載體類,參見:Classes.hbm.xml
          <class name="Classes" table="t_classes" batch-size="3">

          在hibernate.cfg.xml中設(shè)置
          <property name="hibernate.jdbc.fetch_size">50</property>

          posted on 2009-11-03 16:34 junly 閱讀(776) 評論(0)  編輯  收藏 所屬分類: hibernate/orm
          主站蜘蛛池模板: 西华县| 镇康县| 突泉县| 新巴尔虎左旗| 金平| 宁陕县| 徐州市| 乳源| 义乌市| 中江县| 德格县| 克拉玛依市| 龙门县| 望谟县| 新疆| 福海县| 武川县| 怀安县| 托克逊县| 永康市| 唐山市| 潞西市| 四会市| 莱州市| 银川市| 攀枝花市| 许昌县| 房产| 淮滨县| 石柱| 莒南县| 西平县| 东乡| 汾阳市| 桑植县| 凤冈县| 山西省| 深州市| 永吉县| 苏尼特左旗| 宜阳县|