• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA Hibernate Optimistic Lock exception without @Version

 
Markus Schmider
Ranch Hand
Posts: 133
1
  • 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.

 
E Armitage
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!