-->
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 performs unexpected request to database
PostPosted: Tue May 25, 2010 5:04 am 
Newbie

Joined: Wed Nov 25, 2009 11:35 am
Posts: 17
Hello

I have simple code to read "Trans" for given Id from db:

Code:
      Integer trintn = new Integer(31402021);
      session.get(Trans.class, trintn);


output I get is:
Hibernate: select trans0_.trintn as ... from Trans trans0_ where trans0_.trintn=?
Hibernate: select invoice0_.invtintn as ... from Invoice invoice0_ where invoice0_.invtintn=? and invoice0_.inext=?

Why hibernate performs extra request for invoice object ?

My mapping is:

Code:
<hibernate-mapping package="scc.ar.model">
  <class dynamic-update="true" name="Trans" table="Trans">
    <id column="trintn" name="trintn">
      <generator class="native">
        <param name="sequence">trans_trintn_seq</param>
      </generator>
    </id>
    <many-to-one class="Account" name="tracintn" cascade="save-update" column="tracintn"/>
    <many-to-one class="Invoice" name="trvtintnTrinext" insert="false" update="false" cascade="save-update">
      <column name="trvtintn"/>
      <column name="trinext"/>
    </many-to-one>
    <many-to-one class="Rmtbatchadj" name="trrbaintn" cascade="save-update" column="trrbaintn"/>
    <many-to-one class="Rmtclaim" name="trrcintn" cascade="save-update" column="trrcintn"/>
    <many-to-one class="Visit" name="trppmtvtintn" cascade="save-update" column="trppmtvtintn"/>
    <many-to-one class="Trtype" name="trttcode" cascade="save-update" column="trttcode"/>
    <many-to-one class="Visit" name="trvtintn" cascade="save-update" column="trvtintn"/>
    <many-to-one class="Batch" name="trbtintn" cascade="save-update" column="trbtintn"/>
    <many-to-one class="Payor" name="trpyocode" cascade="save-update" column="trpyocode"/>
    <property name="trinext" column="trinext" type="big_decimal"/>
    <property name="trdt" column="trdt" type="timestamp"/>
    <property name="trdesc" column="trdesc" type="string"/>
    <property name="tramt" column="tramt" type="scc.ar.model.utils.MonetaryAmountUserType"/>
    <property name="trtaxamt" column="trtaxamt" type="scc.ar.model.utils.MonetaryAmountUserType"/>
    <property name="trpostdtm" column="trpostdtm" type="timestamp"/>
    <property name="trpostusr" column="trpostusr" type="string"/>
    <property name="trblktrintn" column="trblktrintn" type="big_decimal"/>
    <property name="trcmptrintn" column="trcmptrintn" type="big_decimal"/>
    <property name="trtype" column="trtype">
      <type name="scc.ar.model.utils.EnumUserType">
        <param name="enumClassName">scc.ar.model.enums.eTrtype</param>
      </type>
    </property>
    <property name="trprnconf" column="trprnconf" type="big_decimal"/>
    <property name="trdunlvl" column="trdunlvl" type="big_decimal"/>
    <property name="trnextactdt" column="trnextactdt" type="timestamp"/>
    <property name="trstat" column="trstat">
      <type name="scc.ar.model.utils.EnumUserType">
        <param name="enumClassName">scc.ar.model.enums.eTransrecstat</param>
      </type>
    </property>
    <property name="trcreatdtm" column="trcreatdtm" type="timestamp"/>
    <property name="treditdtm" column="treditdtm" type="timestamp"/>
    <property name="trcreatby" column="trcreatby" type="string"/>
    <property name="treditby" column="treditby" type="string"/>
    <property name="trflags" column="trflags" type="big_decimal"/>
    <property name="trglpostdtm" column="trglpostdtm" type="timestamp"/>
    <property name="trrevers" column="trrevers">
      <type name="scc.ar.model.utils.EnumUserType">
        <param name="enumClassName">scc.ar.model.enums.eTrrevers</param>
      </type>
    </property>
    <property name="trbillto" column="trbillto" type="string"/>
    <set name="dttrintnSet" inverse="true">
      <key column="dttrintn"/>
      <one-to-many class="Dettrans"/>
    </set>
  </class>
</hibernate-mapping>


Thank you for advice


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.