-->
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.  [ 3 posts ] 
Author Message
 Post subject: how handle huge data volume
PostPosted: Mon Apr 21, 2008 5:20 pm 
Newbie

Joined: Mon Apr 21, 2008 5:07 pm
Posts: 6
hello everybody

when one needs to retrieve giant data volume from the database
which hibernate possibilities are there to optimize the operation
and not to block the database and what one should keep in mind?

It won't help just to do a

Criteria crit = sess.createCriteria(Cat.class);
crit.setMaxResults(50);
List cats = crit.list();

As maxResults here it is set to 50 .. what if I would like to retrieve
the other 50 when there are 100 .. or 100.000? Is there something
like pagination implemented?


Thanks and
see you


Hibernate version: 3.2
Name and version of the database you are using:Oracle


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 21, 2008 9:42 pm 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
Code:
criteria.setMaxResults(Constants.LIST_TOTAL_DATA_PER_PAGE);
         criteria.setFirstResult(Constants.LIST_TOTAL_DATA_PER_PAGE * currentPage);


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 22, 2008 5:38 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
http://www.hibernate.org/116.html#A32

or u can use ScrollableResult to open cursor -> criteria.scroll(ScrollMode.FORWARD_ONLY)

don`t forget to evict object from session if u plan e.g. to iterate over all object in during one session


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