File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate optimization problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate optimization problem" Watch "Hibernate optimization problem" New topic

Hibernate optimization problem

Elizabath Lima
Ranch Hand

Joined: Nov 23, 2005
Posts: 32

I'm developing a web application using spring and hibernate and Mysql. My database contains huge records (more than 2 lacs). Most of the time, for each user, i need to fire a query to select a considerable number of records (say 20 thousand). After fetching the result i need to disply it using pagination. So i don't nedd all the records at the same time, but by clicking on the next page (or a specific page number) link i need to show the respective records.

While executing the query, it takes long time and responds with out of memory error. I tried setting getHibernateTemplate().setFetchSize(200) but the performance is same. I tried different combination of changing the mysql driver, setting hibernate.jdbc.batch_size but all in vain.

How i can resolve this performance issue? wat approach i can follow to solve this? What parameters i need to take care for a large database application like this?
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
Criteria.setFirstResult(), Criteria.setMaxResults()

and not everyone knows what a lac is :-)
Peer Reynders

Joined: Aug 19, 2005
Posts: 2922
Originally posted by pascal betz:
and not everyone knows what a lac is


Lac is also a less common way to spell lakh, in the Indian numbering system equivalent to 100,000
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
i learned that when i was in india ....

there is also "crore" which is a 100 * lakh (lac) :-)
I agree. Here's the link:
subject: Hibernate optimization problem