Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: ...HibernateOptimisticLockingFailureException breaks app
PostPosted: Mon Jul 20, 2009 11:03 am 
Newbie

Joined: Mon Jan 05, 2009 5:25 pm
Posts: 8
[1244037] StackTrace Sanitizing stacktrace:
org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [Ad] with identifier [4986]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [Ad#4986]
....

and it breaks my application. The console kept spitting same things out and the site did not work at all until I restarted it...

I am using Grails.

I think that this might have to do with a concurrent edit and the setting:

cache usage:'nonstrict-read-write', include:'non-lazy';

in my domains.

I am considering changing this to read-write only, but I am some questions on what they mean...

As I understand there is 4 different types of settings.

1. transactional

2. read-write

3. nonstrict-read-write

4. read-only


a) If I change my setting to read-write, will this still happen, if say the problem was due to a concurrent edit or update?

b) And also, how does this setting affect the use of cache and speed compared to nonstrict-read-write?

c) What is the transactional for?

d) Should I be using include:'non-lazy' ? I have the same settings in my association aswell... is it redundant?

If you know any of these answers, please try to be clear :)

Sincerely / Moe

ps. Why does the application break? I understand that hibernate might be throwing this exception up to the caller, and thats how it should be done perhaps. How can this be caught and perhaps be dismissed instead of breaking the application? Any chance anyone knows how to do this in Grails?


Top
 Profile  
 
 Post subject: Re: ...HibernateOptimisticLockingFailureException breaks app
PostPosted: Sat Aug 01, 2009 12:35 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2296
Location: Third rock from the Sun
Hello,
I'm sorry I don't know about your problem, your question is more appropriate for the "Hibernate Users" forums ( this is for Search, Validator, Shards only), or it could be a Spring or Grails problem.

The StaleObjectStateException is fine, how you handle it looks wrong so it's either a bug in those frameworks or in your application design.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.