-->
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: lazy loading collection batch-size
PostPosted: Tue Jun 29, 2004 6:31 am 
Newbie

Joined: Tue Feb 24, 2004 12:06 pm
Posts: 7
Hi all;

i have a problem with lazy load in batch of collections.

I have the following mapping:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="package.Lot"
table="LOT" dynamic-update="false" dynamic-insert="false" >
<!--<cache usage="read-only" />-->
<id name="id" type="java.lang.Long" column="LIR_K_NUM" >
<generator class="assigned">
</generator>
</id>
<set name="contrats" lazy="true" inverse="true" sort="unsorted"
batch-size="25" >
<key column="LIR_K_NUM"/>
<one-to-many
class="package.Contrat"
/>
</set>
<set name="mouvements" lazy="true" inverse="true" sort="unsorted"
batch-size="25">
<key column="LIR_K_NUM"/>
<one-to-many
class="package.Mouvement"
/>
</set>
<property name="exerciceComptable" type="java.lang.Integer"
column="LIR_P_EXE_COMPT" />
<property name="debitTax" type="java.lang.String"
column="LIR_I_DEB_TAX" />
<property name="typeFlux" type="java.lang.String"
column="LIR_C_TYP_FLX" />
<property name="numeroEnvoi" type="java.lang.Long"
column="LIR_N_NUM_ENVOI" />
<property name="date" type="java.util.Calendar" column="LIR_D_HDMAJ" />
</class>
</hibernate-mapping>

As you can see, this object has 2 lazy-loading collections with a specified batch size.

I have a query which returns several objects of this type.
And then, in the code, i do a get on the collections of each of the objects returned.
However, i see that hibernate generates a new query for each of these gets...
And i hoped thas hibernate would do juste one query loadind 50 collections of these objects on the first get.

What is the problem?

Thank you for the answer in advance.

Jean


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.