Piyush Aghera
Piyush Aghera

Reputation: 965

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. when i set lazy loading to false , it is not working. It is fire lots of select query to db to load other table.

<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?

Upvotes: 2

Views: 1497

Answers (1)

shreyansh jogi
shreyansh jogi

Reputation: 2102

use

fetch="select|subselect|join|batch"

and select appropriate association that you required

Upvotes: 1

Related Questions