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 6350495
In Process

The Archive Base Latest Questions

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

We ran into a problem in a large, Java, Hibernate-based system last week. Our

  • 0

We ran into a problem in a large, Java, Hibernate-based system last week. Our backend MySQL database (hosted on Amazon RDS) went unresponsive for 5-10 minutes (it would still accept connections, but due to hardware issues, its write throughput dropped to zero). This piece of code:

getSession().save(entity); //session is an instance of org.hibernate.Session

Ended up hanging for about 8.5 minutes. So clearly there’s a need for some sort of timeout condition on this statement to make it fail in the case of my particular scenario. I can’t guarantee that I won’t see a similar hardware issue in the future.

I should mention that I’m still fairly new to Hibernate, so it’s possible that I just don’t understand some things like the association between using save() versus using Criteria, Transactions, etc. So I’ve found the following:

  • hibernate.c3p0.timeout can be used to set connection timeouts on the C3P0 connection pool
  • getSession().getTransaction().setTimeout(...) can be used to timeout a transaction
  • getSession().createQuery(...).setTimeout(...) can be used to timeout a query
  • I’ve seen the JPA 2 javax.persistence.query.timeout, but I’m not entirely sure it’s what I want (I also don’t think my Hibernate version is new enough)

None of these seems like exactly what I want to do (except maybe the JPA 2 one). This seems like it should be really simple. Is there something I’m missing here?

Thanks!

  • 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-24T21:49:15+00:00Added an answer on May 24, 2026 at 9:49 pm

    I’ve looked for this same kind of thing before, but using Oracle on the back end instead of MySQL. As far as I’ve ever seen, there just isn’t any mechanism for this in any library, including the JDBC drivers. Even the timeouts you listed, like Transaction.setTimeout(), don’t do what you’d expect. They just wait for a database statement to finish executing, and then throw a TimeoutException if it exceeded the given timeout. That’s pretty useless if you have a query that’s just hanging indefinitely. The only potential out-of-the-box solution I’ve ever found is to set a query timeout on the database itself, which on Oracle is a global setting and will affect all queries against the database. That’s not terribly useful. As far as I can tell, to do what you’re looking for, you’d have to start a separate thread to time queries as they’re made and somehow interrupt them when they hit the timeout. I haven’t found any support at all for doing this from either Oracle or any db-related libraries/frameworks.

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

Sidebar

Related Questions

I ran into the following problem in dynamically creating topics for our ActiveMQ system:
I've ran into a problem while trying to test following IRepository based on NHibernate:
Similar to my last question, but I ran into problem lets say I have
I've ran into a really weird problem while working on a large project. I
I ran into the problem that my primary key sequence is not in sync
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
I recently ran into a problem that I thought boost::lambda or boost::phoenix could help
I recently ran into a problem with a COM object that was using a
I just ran into a problem with the version of JAX-WS in JDK 1.6.0
I'm learning ObjectiveC and ran into a problem relating to introspection. Basically, I'm looping

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.