-->
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: setFetchSize() is not working for my code
PostPosted: Fri Jun 29, 2007 9:49 am 
Newbie

Joined: Fri Jun 29, 2007 9:03 am
Posts: 12
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0

I tried a following code
Code:
Criteria cri = session.createCriteria(Instrument.class);
         
   instrument = cri.add(Restrictions.like("shortName", "%" +description + "%").ignoreCase())
                    .setFetchSize(3)
                    .list();

this code should return me 3 records .. But it returns more than 3 records

But if i try
Code:
Criteria cri = session.createCriteria(Instrument.class).setMaxResults(3);

            instrument = cri.add(Restrictions.like("shortName", "%" + description + "%").ignoreCase()) .list();


Quote:
this works fine . i want to know why the setMaxResults() work and not setFetchSize()


Top
 Profile  
 
 Post subject: Look at this thread
PostPosted: Fri Jul 06, 2007 2:59 pm 
Newbie

Joined: Thu May 31, 2007 3:27 am
Posts: 11
I was wondering the same thing but I found the answer there:

http://forum.hibernate.org/viewtopic.ph ... tfetchsize


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.