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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:16:40+00:00 2026-06-09T20:16:40+00:00

Few facts regarding the setup: It’s a Tomcat based app (althoug the issues arise

  • 0

Few facts regarding the setup:

  • It’s a Tomcat based app (althoug the issues arise outside Tomcat’s context as well – JUNIT)
  • Not using Spring
  • Every thread has its own Hibernate Session (at TLS)
  • Objects are being saved/loaded in a mixed way, i.e ObjA may be created by thread A and later be manipulated by thread B and even later be updated by thread A and yet again be manipulated by thread Z but this time using HQL!

Having the above setup I’m getting errors such as:

  • org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions
  • org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

My understanding is that

  • It’s all related to Hibernate’s Session, being that a session “owns” the objects “attached” to it (those it created/loaded)
  • AND POSSIBLY an issue of caching

The question is obvious:

  • Am I understanding the core issue (above)?
  • How do I avoid such issues?
  • Is there a rule of thumb that would help avoid these issues?
  • Would using Spring help solving it (be a bit specific about it please)?
  • Would detaching from Session every object after fetching it from the datastore, and attaching it to a Session later just before updating it would be the ideal way to handle it?

I could of course avoid all of it if I’d use only one Session object but that sounds so… blocking (thread-wise).

I’m sure these sort of issues were solved long time ago, just need to find it (without re-inventing the wheel).

  • 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-09T20:16:42+00:00Added an answer on June 9, 2026 at 8:16 pm

    Calling clear() before fetching the object(s).

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

Sidebar

Related Questions

I have a few questions that I hope clarity and facts can be fed
Few days back I put a question regarding mapping two classes Message and MessageStatusHistory
I know few facts from Azure: Limited bandwidth for each instance, for example: Extra
I have a couple of questions regarding a modular GWT based application framework. I
Let's state a few facts upfront: Livedocs tells us that dynamic classes enable us
Few basic doubts I have: 1. Is primary key column automatically indexed? 2. What
few days ago i asked about how to get all running processes in the
few days ago i read tutorial about GenericRepository and Unit Of Work patterns http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application
Few users of my Flex 4.6 web application are complaining, that the mx.controls.PopUpButton at
few links on Internet (ex: http://drdobbs.com/article/print?articleId=232300575&siteSectionName= http://www.hydrogenaudio.org/forums//lofiversion/index.php/t74268.html ) point out that there is a

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.