-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate performance problem
PostPosted: Mon Feb 20, 2012 8:28 am 
Newbie

Joined: Mon Feb 20, 2012 8:15 am
Posts: 1
hi ,

i am using hiberante 3.For this i have little bit confusion on inverse attribute.Below are hbm files.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.crimsonlogic.trade.mcms.simplifieddeclaration.model">
   <class name="SimplifiedDeclarationDTO" table="TMCMS_PCD_DECLARATION">
      <id name="declarationId" type="java.lang.Long">
         <column name="DECLARATION_ID" />
         <generator class="sequence">
            <param name="sequence">TMCMS_PCD_DEC_ID_SEQ</param>
         </generator>
      </id>
      <property name="customsOffice" column="CUST_OFC" type="string" />
      <property name="cpcId" column="CPC_ID" type="long" />      
      <property name="createdBy" column="CREATED_BY" type="string" />
      <property name="createdDate" column="CREATED_DATE" type="timestamp" />
      <property name="updatedBy" column="UPDATED_BY" type="string" />
      <property name="updatedDate" column="UPDATED_DATE" type="timestamp" />
      <bag name="decItemList" cascade="all-delete-orphan" fetch="subselect" lazy="false">
            <key column="DECLARATION_ID" not-null="true"/>
            <one-to-many class="SimplifiedDecItemDTO"/>
        </bag>
        <bag name="decTaxList" cascade="all-delete-orphan"  fetch="subselect" lazy="false">
            <key column="DECLARATION_ID" not-null="true"/>
            <one-to-many class="SimplifiedDecTaxDTO"/>
        </bag>
   </class>
</hibernate-mapping>



Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.crimsonlogic.trade.mcms.simplifieddeclaration.model">
   <class name="SimplifiedDecItemDTO" table="TMCMS_PCD_DEC_ITEM">
      <id name="itemId" type="java.lang.Long">
            <column name="ITEM_ID"/>         
            <generator class="sequence">
               <param name="sequence">TMCMS_PCD_ITEM_ID_SEQ</param>
            </generator>
        </id>
      <property name="aggregateTax" column="AGG_TAX" type="big_decimal"/>      
      <!--<property name="declarationId" column="DECLARATION_ID"  type="long" not-null="false"/>
      --><property name="hsCode" column="HS_CODE"  type="string"/>      
      <property name="quantity"  column="QUANTITY" type="big_decimal"/>
      <property name="valueOfCurrency"  column="CURRENCY_VALUE" type="big_decimal"/>
      <property name="weight"  column="GROSS_WEIGHT" type="big_decimal"/>
      
      <many-to-one name="simplifiedDeclarationDTO"  class="SimplifiedDeclarationDTO" lazy="false" insert="false" update="false" >
         <column name="DECLARATION_ID" not-null="true"></column>
      </many-to-one>
         
   </class>
   </hibernate-mapping>



Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.crimsonlogic.trade.mcms.simplifieddeclaration.model">

   <class name="SimplifiedDecTaxDTO" table="TMCMS_PCD_DEC_TAX">
      <id name="decTaxId" type="java.lang.Long">
         <column name="DEC_TAX_ID" />
         <generator class="sequence">
            <param name="sequence">TMCMS_PCD_DEC_TAX_ID_SEQ</param>
         </generator>
      </id>      
      <property name="amount" column="TAX_AMT" type="big_decimal"/>         
      <!--<property name="declarationId" column="DECLARATION_ID" type="long" not-null="false"/>
      --><property name="sectionCode" column="SECTION_CODE" type="string"/>
      <many-to-one name="simplifiedDeclarationDTO" class="SimplifiedDeclarationDTO" lazy="false" insert="false" update="false">
      <column name="DECLARATION_ID" not-null="true"></column>
      </many-to-one>
         
            
   </class>
   </hibernate-mapping>


as of now i haven't mentioned any inverse attribute.But hiberante only updating child foreign keys.Due to this it was generating many update statements while updating time.I want to reduce those calls by using inverse=true.I have tested like that also but child table was not updating with parent key.What might be the problem.

Please anybody help me!

Best Regards,
Murali.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.