Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8478631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:47:55+00:00 2026-06-10T18:47:55+00:00

I needed to create a batch recently which reads over a table with millions

  • 0

I needed to create a batch recently which reads over a table with millions of rows. The table has about 12 columns and I only need to do a read operation. But I needed all fields therefore I thought about using persistence objects.

I really used only the most basic code only to achieve that and with no tweaks. JPA was quite annoying because it forced me to use custom paging with maxResults and minResults. You can view the approximate code hyperlinks below, if you are interested. There really is nothing else to it, beside the default XML files etc.

The JPA code: http://codeviewer.org/view/code:297e
The Hibernate code: http://codeviewer.org/view/code:297f
The JDBC code: same as above, but with “d” on the end (sorry I can only post 2 links)

The result in time of finished operations was something like that. I am only talking of read-operations:

JPA:         Per 5 seconds: 1.000||Per Minute: 12.000||Per Hour: 720.000
Hibernate:   Per 5 seconds: 20.000||Per Minute: 240.000||Per Hour: 14.400.000
JDBC:        Per 5 seconds: 50.000-80.000||Per Minute: 600.000-960.000||Per Hour: 36.000.000-57.600.000

I can’t explain it, but JPA is ridiculous. It can only be a big bad joke. The funny thing is that it startet with the same speed as the Hibernate code, but after about 30.000 records it became slower and slower until it got stable at 1.000 read operations per 5 seconds. It has reached that point after finishing approximately 100.000 records. But honestly… there is no point in that speed.

Why is that so? Please explain it to me. I really don’t know what I’m doing wrong. But I also think it shouldn’t be that slow, even with default settings. It can’t be and it must not be! In comparison to that Hibernate and JDBC speed is acceptable and stable all the time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:47:56+00:00Added an answer on June 10, 2026 at 6:47 pm

    With Hibernate you get a good performance using only one query and scrollable results. Unfortunately, this is not currently possible in JPA, and you must execute a query for every result page.

    So, you are doing it right. But your page size is only set to 20 results. This is very few, so your code makes a very high number of queries. Try with greater size, for example 10000 results and performance probably will increase. Anyway, I think you won’t be able to get numbers close to Hibernate ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently needed to create speech bubbles. To create the little triangular tip at
which framework helps in reducing the number of lines of code needed to create
I needed to create a daily (automatic) email with information about a service I
Using a WebMethod, I get a value needed to create a HTML Table and
I needed to create an application using Struts2 as MVC,Hibernate for data access and
What CSS is needed to create such an HTML layout: +--[li]---------------------------------------------+ |+--[div]-------------------------------------++---+| || A
So I came to a point where I needed to create a custom query
I'm reaaallly new at JSON, but here's what I got. I needed to create
In unit testing, the setup method is used to create the objects needed for
Does anybody know what permissions are needed to create ITASK? This is the error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.