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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:26:13+00:00 2026-05-27T03:26:13+00:00

My application has a delete user option. Now in order to check concurrency condition

  • 0

My application has a delete user option. Now in order to check concurrency condition I tried the following use case

  1. opened application in chrome and firefox browser.
  2. deleted user in firefox
  3. now trying to delete the same user in chrome browser I get exception org.hibernate.StaleObjectStateException .. which is right .. since I am trying to delete an object which doesn’t exists. But I am not able to catch this exception
try{
   getHibernateTemplate().delete(userObj);
} catch (StaleObjectStateException e) {
   e.printStackTrace();
}

How do i catch this exception ??

  • 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-27T03:26:13+00:00Added an answer on May 27, 2026 at 3:26 am

    You won’t be able to catch it there, because it’s not the delete call that throws the exception, but the flush of the session, which happens later (before the execution of a query, or before the transaction commit).

    You should not catch this exception anyway, because when Hibernate throws an exception, you can’t continue using the session anymore: it’s in an unstable state. The only part of the application where such an exception can be caught is outside of the transaction, in order to display an error message to the user (or retry, but this won’t be possible in this particular case).

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

Sidebar

Related Questions

Say the user somehow managed to delete my application’s core data store. (Which has
My application has a need to let the user choose a date from a
My application has a module which allows the user to add jButtons on the
I have a PHP application, which has a delete function on one of the
I have created a Java application which has the following Apache Ant build file:
In my application, every user has its own settings, that I save to a
In my ASP.NET web-application I use NHibernate to persist my User-Instances, where each of
Application has an auxiliary thread. This thread is not meant to run all the
Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument
My application has no forms. It runs by calling Application.Run();

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.