• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JPA Hibernate Optimistic Lock exception without @Version

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

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.

Posts: 989
  • 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
    Bookmark Topic Watch Topic
  • New Topic