• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate slow when pulling a large dataset

Javid Jamae
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using Hibernate to pull a large number of objects (~70,000) from two tables that are joined together. The HQL does a join and generates just a single SQL statement. I've captured the SQL query and have verified that it runs pretty fast. The problem is that Hibernate takes about 6 minutes to create all the objects I need after the query has been run.

I wrote some JDBC code to pull the same 70,000 records, using the same query, then create objects out of the resultset. The total time in this case is about 6-8 seconds.

I can post the code if needed, but is this poor of performance typical with that number of records? Any ideas what Hibernate is doing that takes so long? Any general ideas on how to optimize the post-query object creation that Hibernate does?

BTW: Pagination is not an option as I am trying to load data to prime a browser-side cache built on Google Gears.
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!