-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to use the batch mechanism for collection load?
PostPosted: Thu Sep 25, 2008 11:24 am 
Newbie

Joined: Tue Aug 15, 2006 8:49 am
Posts: 9
How to use the batch mechanism in this query:

IList result = test.session.CreateQuery("from TestRemonts").List();// CreateCriteria(typeof(TestRemonts)).List();

This collection loaded with one select all.

How to make query for use in batch-mode (for 10 results in query) in this code:

Code:
foreach (TestRemonts data in result)
{
...   //batch-size using there
}


Hibernate version:
1.2
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="true" namespace="KRS" assembly="Persistent">
   <class name="TestRemonts" table="TEST_REMONTS" lazy="true" batch-size="2" >
      <id name="IdRem" column="ID_REM" type="Decimal" unsaved-value="0">
         <generator class="assigned"/>
      </id>
      <property column="NAME_YKPG" type="String" name="NameYkpg" length="50" />
      <property column="ID_KUST" type="String" name="IdKust" length="100" />
      <property column="UWI" type="String" name="Uwi" length="10" />
   </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 6:56 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
The batch-size parameter is an "optimization" that instructs Hibernate to grab a given number of children at a time when a select on the children's table is performed.

But that's it. Its only purpose if to reduce the number of generated SQL queries.

As far as I know, there is nothing you can do, regarding those "batches", in your code.

_________________
Gonzalo Díaz


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.