-->
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.  [ 6 posts ] 
Author Message
 Post subject: Lazy loading for one to one mapping
PostPosted: Tue Jan 09, 2007 5:13 am 
Newbie

Joined: Tue Nov 21, 2006 2:14 am
Posts: 7
Location: Chennai, India
i have one header table(table1) and three child tables (table2 and table3 and table 4) which are linked by the relationship as mentioned in the mapping file below.

i have a search screen in which i search based on some criteria and display the displayed the header details alone. but what i notice is that even-though i have given lazy="true" for all associations, the details are still fetched from table2, table3. in this the details of table 4 are not fetched (this is fine).

in the same way i need to stop details from table 2 and 3 to be fetched, as this is a search screen which can return 50-60 records and if fetches the other tables the process it getting slow.

please let me know how to make lazy-"true" work for one to one relationship and many-to-one relationship for tables 2 and 3.



Code:
<class name="test.Class1" table="Table1">
      <id name="id" column="primary" type="int">
         <generator class="native">
            <param name="sequence">SEQ</param>
           </generator>
      </id>
      
   
      <many-to-one name="class2" class="test.Class2" 
         column="tbl2_id" lazy="true" unique="true" cascade="none" />
         
      <one-to-one name="class3" class="test.class3"
         lazy="true" cascade ="all" />
      
      <set name="class4List" lazy="true" inverse="true" cascade="all">
           <key column="tbl4_id" not-null="true"/>
              <one-to-many class="test.Class4"/>
          </set>
</class>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 9:51 am 
Regular
Regular

Joined: Thu Aug 17, 2006 4:50 am
Posts: 55
Location: Mallorca
are class2, class3 and class4 mapped with lazy="true" ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 1:16 pm 
Regular
Regular

Joined: Wed Dec 07, 2005 4:19 pm
Posts: 53
<class name="test.Class2" table="class2" lazy="true">

Don't forget to rate...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 09, 2007 11:23 pm 
Newbie

Joined: Tue Nov 21, 2006 2:14 am
Posts: 7
Location: Chennai, India
it still does not work, i had tried this option before.............

any other suggestions please


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 10, 2007 4:19 am 
Regular
Regular

Joined: Thu Aug 17, 2006 4:50 am
Posts: 55
Location: Mallorca
could you post your search code ? maybe you are eager-loading the entities there.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 17, 2007 10:04 am 
Newbie

Joined: Tue Nov 21, 2006 2:14 am
Posts: 7
Location: Chennai, India
sorry for replying late..

i am building a HQL query dynamically by using findByNamedParam() method using Spring


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

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.