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

  • SEARCH
  • Home
  • 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 7593907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:17:14+00:00 2026-05-30T21:17:14+00:00

As you all know, Hibernate introduces overhead to basically all operations on database due

  • 0

As you all know, Hibernate introduces overhead to basically all operations on database due to management of internal cache and object state.

What we have currently in our application is that we read data using plain SQL (JDBC) and use Hibernate for saving and updating. Reason is that we need to load a lot of information in every run of calculation but update only a limited part.

Now, we know that this approach is not really the cleanest and we did some tests where we tried to fine-tune Hibernate’s reading but what we have achieved is following:

Read time JDBC (session.doWork): 23 s
Read time Hibernate (session.createQuery with lazy fetch): 94 s

It seems to us that existing overhead is due to Hibernate’s additional processing and we were wondering if parallelizing the read itself could be of any help (we are reading a lot of tables which we could do in parallel)? Are Hibernate’s session and transaction designed to be used from multiple threads safely?

Also, if you have any other idea, what could help to speed up this ready, we would be thankful.

  • 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-05-30T21:17:17+00:00Added an answer on May 30, 2026 at 9:17 pm

    if parallelizing the read itself could be of any help (we are reading a lot of tables which we could do in parallel)?

    It depends. If your database is clustered or different tables reside in different table spaces located on different physical disks or machines, parallelization might speed up things. Otherwise I/O is the bottleneck.

    Also make sure your queries are compiled once and reused, the parsing/compilation phase in the database server may take some time (but can actually be parallelized successfully because this part is CPU-bound).

    Are Hibernate’s session and transaction designed to be used from multiple threads safely?

    Absolutely not. Sessions and transactions in Hibernate are inherently bound to a database connection. And the connection is single-threaded.

    Also, if you have any other idea, what could help to speed up this ready, we would be thankful.

    • use prepared statements/compiled queries to avoid compilation overhead in DBMS

    • experiment with L2 and query cache in Hibernate

    • make sure your connection pool is configured properly

    • monitor GC activity and memomry consumption, maybe your Hibernate session is growing too large?

    • consider stored procedures, they tend to be much faster

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

Sidebar

Related Questions

We all know you can't do the following because of ConcurrentModificationException : for (Object
Does anyone know what this is all about: component class not found with Hibernate?
An object I mapped with hibernate has strange behavior. In order to know why
In my web app,I am using hibernate and hsqldb for database operations..and use Ant
First of all I want you to know I am very new to Hibernate.
In hibernate mapping, I have set the property lazy=false , and this fetches all
I have an application built on Spring MVC that uses Hibernate for all of
How to check that Hibernate mapping configuration matches database? I'd like know if I
I have been using Hibernate + HSQLDB on my desktop for developing a database
Does nHibernate create code that has all the details of the column? I know

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.