Questions tagged [staleobjectstate]

32 questions
30
votes
5 answers

What is stale state?

I was reading about the object pool pattern on Wikipedia (http://en.wikipedia.org/wiki/Object_pool) and it mentions "dangerously stale state". What exactly is "stale" state? I know state is variables/data, such as my fields and properties, but what…
GurdeepS
  • 65,107
  • 109
  • 251
  • 387
18
votes
4 answers

StaleObjectstateException row was updated or deleted by

I am getting this exception in a controller of a web application based on spring framework using hibernate. I have tried many ways to counter this but could not resolve it. In the controller's method, handleRequestInternal, there are calls made to…
Saky
  • 354
  • 2
  • 5
  • 16
12
votes
3 answers

How to fix StaleObjectStateException with JPA and Hibernate

Controller Logic: def updateObject() { Object o = Object.get(params.id as Long) o.otherObjects.clear() objectDataService.saveObject(o.id) OtherObject newObject = new OtherObject; o.addToOtherObjects(newObject) …
Sebastian Flückiger
  • 5,525
  • 8
  • 33
  • 69
9
votes
1 answer

How does one gracefully merge object graphs after NHibernate StaleObjectStateException?

We are trying to combine objects after a StaleObjectStateException has been thrown to save a merged copy. Here's our environmental situation: List item Multi-user system WPF Desktop application, SQL Server 2008 database NHibernate 3.1.0.4000,…
4
votes
1 answer

When does grails check for Object Staleness?

I'm using Grails 2.5.1, and I have a controller calling a service method which occasionally results in a StaleObjectStateException. The code in the service method has a try catch around the obj.save() call which just ignores the exception. However,…
Townsfolk
  • 1,282
  • 1
  • 9
  • 21
4
votes
1 answer

Where to handle StaleObjectStateException in asp.net mvc application?

I'm using Session per Request pattern. Transactions are managed automatically. How can I easily handle StaleObjectStateException and show some specific view?
dariol
  • 1,959
  • 17
  • 26
3
votes
1 answer

StaleObjectStateException after refreshing object

When I try to commit my session and another user also changed that same object, then Hibernate throws a StaleObjectStateException. When I try to recover from that exception I call: session.refresh() Then I once again call the commit…
bvanvelsen - ACA Group
  • 1,741
  • 1
  • 14
  • 25
3
votes
3 answers

How should NHibernate update properties mapped as Version

Using fluent NHibernate I have a property on a class mapped using Version Version(x => x.Version); When I save the object, the Version property gets incremented in the database as I would expect, but the value of the property on the object only…
Simon P Stevens
  • 27,303
  • 5
  • 81
  • 107
3
votes
3 answers

General Problems With Geb (StaleElementReferenceException & Wait Timeouts)

According to the "Book of Geb" I started to map our portal's web pages. I prefer to use variables defined within static content closure block and accessing them afterwards in page methods: static content = { buttonSend { $("input", type:…
AndyDoe
  • 31
  • 1
  • 6
2
votes
2 answers

Constraint Violation Handling in Winforms Using NHibernate

I would like to handle the case where a user is editing an object from a database in a Windows Forms application, makes an edit that would violate a database constraint (i.e. column unique value), saves the entity back to the database, and…
2
votes
2 answers

React useEffect stale value inside function

How would one update the value of variable simulationOn inside of function executeSimulation in the following context: App this.state.simulationOn changes via external code --> ... --> React stateless component (Robot) rerendered --> useEffect…
2
votes
3 answers

In grails, why do I get a StaleObjectStateException directly after refresh?

I got code like this: def myObject = MyDomainClass.get(myId) myObject.refresh() myObject.myProperty = myValue myObject.save(flush:true, failOnError:true) Despite of the get and the refresh, I sometimes get an…
2
votes
2 answers

Not able to catch org.hibernate.StaleObjectStateException

Can we not catch the StaleObjectStateException? I have catch block with StaleObjectStateException , so when method is throwing this error it is coming to this catch block but still throwing the same exception again. I know the reason why this…
Reddy
  • 41
  • 3
  • 11
2
votes
2 answers

Hibernate - StaleObjectStateException in query possible?

Is it possible to get a StaleObjectStateException with Hibernate when you do the same query twice inside one tx if the result data of that query gets changed by a concurrent update inside a different session between the first and the second query? I…
1
vote
2 answers

Hibernate/JPA @Version and @Generated causing StaleObjectStateException

Using Spring 3.1/JPA 2 provided by Hibernate 4.1.0. I have a base class for all of my Entities that provides basic audit capabilities (update timestamp, version number etc.) Because other applications access our database, these must be set via…
Ben M
  • 1,833
  • 1
  • 15
  • 24
1
2 3