• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Catching and Handling dual update in hibernate using Optimistic Locking

 
paul king
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented hibernate into my system and have included the optimistic locking. This all works fine and throws the correct error - StaleObjectStateException. What I need to know is:

How do I throw this back up from the DAO to the user to display an error message on screen.

I'm using struts/jsps as a front end.

Thanks

Paul
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just throw it as is. Otherwise you could create your own Exception with a more meaningful (to the user) message and throw that instead.
 
Sebastian Hennebrueder
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
catch the Runtimeexception in your Struts action and react
or catch it in your business layer and give something else Exception/return value to your struts action.

Best Regards

Sebastian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic