2 Replies Latest reply on Feb 4, 2011 4:42 PM by csab79

    Embedded Many-to-one performance issue

    csab79

      Hi hibernate gurus!

       

      I have experienced the following issue:

       

      I have a class with some properties and 5 many-to-one relationship.

       

      <?xml version="1.0"?>

      <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

      "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

      <hibernate-mapping>

          <class name="hibernate.classes.Fszerzfej" table="FSZERZFEJ" catalog="dev1">

       

                  <id name="ffId" type="int">

                      <column name="FF_ID" />

                      <generator class="identity"/>

                  </id>

       

                  <property name="ffSzerzszam" type="string">

                      <column name="FF_SZERZSZAM" />

                  </property>

                  <property name="ffUgyfelkod" type="string">

                      <column name="FF_UGYFELKOD" />

                  </property>

                  <property name="ffUgyfelnev" type="string">

                      <column name="FF_UGYFELNEV" />

                  </property>

                  <property name="ffStIdRegio" type="int">

                      <column name="ST_ID_REGIO" />

                  </property>

       

                  <property name="ffSzerztipus" type="int">

                      <column name="FF_SZERZTIPUS" />

                  </property>

                  ...

                  ...

                  ...

       

       

                <many-to-one name="regio" class="hibernate.classes.Choicerows" fetch="join" insert="false" update="false">

                            <column name="ST_ID_REGIO" not-null="true" />

                        </many-to-one>

       

       

                  <many-to-one name="sterulet" class="hibernate.classes.Sterulet" fetch="join" insert="false" update="false">

                            <column name="ST_ID_TELEPULES" not-null="true"/>

                        </many-to-one>

       

                  <many-to-one name="szerzst" class="hibernate.classes.Choicerows" fetch="join" insert="false" update="false" >

                            <column name="FF_SZERZST" not-null="true" />

                        </many-to-one>

       

       

                  <many-to-one name="ufkodtipus" class="hibernate.classes.Choicerows" fetch="join" insert="false" update="false" >

                            <column name="FF_UFKODTIPUS" not-null="true" />

                        </many-to-one>

       

                  <many-to-one name="szerztip" class="hibernate.classes.Choicerows" fetch="join" insert="false" update="false">

                            <column name="FF_SZERZTIPUS" not-null="true" />

                        </many-to-one>

       

       

          </class>

       

      </hibernate-mapping>

       

       

      My another class is using fszerzfej class also with many-to-one ralationship:

       

      <?xml version="1.0"?>

      <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

      "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

      <hibernate-mapping>

          <class name="hibernate.classes.Fszerzpont" table="FSZERZPONT" catalog="dev1">

                        <id name="fpId" type="int" >

                                              <column name="FP_ID" />

                                              <generator class="identity" />

                  </id>

                  <property name="fpFfId" type="int">

                      <column name="FP_FF_ID" />

                  </property>

                  <property name="fpPontnev" type="string">

                      <column name="FP_PONTNEV" />

                  </property>

                  <property name="fpStRegio" type="int">

                      <column name="FP_ST_REGIO" />

                  </property>

                  <property name="fpStTelepules" type="int">

                      <column name="FP_ST_TELEPULES" />

                  </property>

                  <property name="fpIranyitoszam" type="string">

                      <column name="FP_IRANYITOSZAM" />

                  </property>

                     ...

                     ...

       

       

                  <many-to-one name="regio" class="hibernate.classes.Choicerows" fetch="join" insert="false" update="false" >

                            <column name="FP_ST_REGIO" not-null="true" />

                        </many-to-one>

       

       

                  <many-to-one name="sterulet" class="hibernate.classes.Sterulet" fetch="join" insert="false" update="false" >

                            <column name="FP_ST_TELEPULES" not-null="true" />

                        </many-to-one>

       

                  <many-to-one name="szerzodesAllapot" class="hibernate.classes.Choicerows" fetch="join" insert="false" update="false">

                            <column name="FP_SZERZST" not-null="true" />

                        </many-to-one>

       

       

                  <many-to-one name="tipus" class="hibernate.classes.GyujtopontTipusok" fetch="join" insert="false" update="false">

                            <column name="gyujtopont_tipus_id" not-null="true" />

                        </many-to-one>

       

                  <many-to-one name="szerzodes" class="hibernate.classes.Fszerzfej" fetch="join" insert="false" update="false" >

                            <column name="FP_FF_ID"/>

                        </many-to-one>        

       

       

          </class>

      </hibernate-mapping>

       

       

       

      The impact is occuring when i am using fszerzpont class the fszerzfej many-to-one relationships fetching mode will be lazy=false.
      I dont understand this bahaviour, i am not using getters exampl from  fszerzfej.regio, fszerzfej.sterulet, fszerzfej.szerzst, fszerzfej.ufkodtipus, fszerzfej.szerztip

       

      I am using this relations only from fszerzfej, not from fszerzpont.

      I assume lazy fetching should doing this but i am surprised why not :S

       

      How could i tell Hibernate do not use load thoose many-to-one- relations into memory?
      My other question is about lazy group fetching. I have read many article but i cant achive to work properly.

      Bulidtime ant instrumentation does not work for me :S 

       

       

      I appreciate any help!
      best regards!  

      Csaba