• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate optimistic-lock="true" not working

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have made optimistic-lock="dirty" dynamic-update="true" for the entity in mapping file.

And the code to test this is:


I am excepting StaleObjectStateException but this code runs without any exception.
please provide some suggestions or code to test this.
[ November 25, 2008: Message edited by: Paul Sturrock ]
 
Pramod Shivale
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
same probelm with optimistic-lock="all"
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I am excepting StaleObjectStateException but this code runs without any exception.


Why are you expecting this? All your code runs in one transaction (though you do nest another in there), so I wouldn't expect any updates to be made to the database (and hence, no version checking) until the second tx.commit().

Try testing it with two clients, ratehr than one client doing two operations.
 
reply
    Bookmark Topic Watch Topic
  • New Topic