简体   繁体   English

如何在以下位置设置fetch =“ Join”和lazy =“ False” <key-many-to-one > hbm.xml中的映射

[英]How to set fetch=“Join” and lazy=“False” in <key-many-to-one > mapping in hbm.xml

I have table mapping in .hbm.xml file as follows. 我在.hbm.xml文件中有表映射,如下所示。 when i set lazy loading to false , it is not working. 当我将延迟加载设置为false时,它不起作用。 It is fire lots of select query to db to load other table. 向db加载其他表需要大量选择查询。

<class name="GroupConfigDO" table="GROUP_CONFIG" >
   <composite-id  >
    <key-property name="Group" column="group" type="java.lang.String"  />
    <key-many-to-one name="Method" column="method"  class="MethodDO" lazy="false" />
        <key-property name="entityId" column="entity_id" type="java.lang.String" /> 

</composite-id>

How can i provide fetch type to join and lazy loading to false? 我如何提供获取类型来加入和延迟加载为false?

use 采用

fetch="select|subselect|join|batch"

and select appropriate association that you required 并选择您需要的适当关联

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM