| 
					
						 Within my mapping file I have set the associations of my object to be fetched lazily, with a batch size of 10. As part of our application it is possible to specifiy different page sizes at runtime. 
 
 I am wanting to retrieve a list of all the accounts, so that the total pages may be determined but only wish to initialise the first page of accounts. We are not using a long session approach thus the page of accounts must be initialised before rendering the page as the session is closed at this point. 
 
 When fetching objects using hibernate using a criteria object, is there any way to over ride the mapping specified batch size. If have tried using criteria.setFetchSize but this does not seem to work.
 
 Hibernate version: 2.1.2
 
 Mapping documents:
 <class name="Account" 
 	   lazy="true" 
 	   dynamic-update="true">
 	   
 	<id name="id">
 		<generator class="native"/>
 	</id>
 	
 	<version name="version"/>
 	
 	<property name="accountCode">
 		<column name="accountCode"
 			  unique="true" 
 			  length="25" 
 			  not-null="true" 
 			  index="idx_accountcode"/>
 	</property>
 			  
 	<property name="description"/>
 			  
 	<many-to-one name="limitGroup" 
 				 class="LimitGroup" 
 				 column="limitGroupId"
 				 cascade="save-update"  
 				 not-null="true"/>
 	
 	<many-to-one name="parent" 
 				 cascade="none"  
 				 column="parentId" 
 				 not-null="false"/>
 	
 	<set name="children" 
 		 cascade="save-update" 
 		 inverse="true" 
 		 lazy="true" 
 		 batch-size="10">
 		 <key column="parentId"/>
 		 <one-to-many class="Account"/>
 	</set>
 </class>
 
 Code between sessionFactory.openSession() and session.close():
 Session session = HibernateUtil.getSession();
         List accountList = null;
         try {
             accountList = HibernateUtil.getSession().createCriteria(Account.class).list();
         }
         catch (HibernateException ex) {
             throw new InfrastructureException(ex);
         }
         return accountList;
 
 Name and version of the database you are using:
 MS SQL Server 2000 
					
  
						
					 |