• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JPA Hibernate Optimistic Lock exception without @Version

 
Ranch Hand
Posts: 153
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am writing a JSE desktop application with JPA hibernate for persistence.



I don't use @Version on any entity.
Still when I try to merge a detached entity of one particular class I get a


I cannot reproduce the error when I write unit-Tests testing the business layer.
I only occurs when the gui is tested (Swing).
Judging from the logging it does not look like a concurrency problem since the update method of the DAO is only called once.

I have no idea how to analyze or solve this problem.

From what I have read, I believe that you have to activate optimistic locking by annotating @Version. I don't do that.

Many thanks for any input.

 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enable logging to see which statement is causing the error. It looks like the record you are trying to update was not found.
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic