1

I have a table with optimistic versioning implemented using hibernate. One row in this table can be updated by more than one transaction at the same time and this update method is in stateless session bean. Issue here is when users are working on application at peak time, three to four transactions trying to update same row and database allows update for first transaction and other transactions getting versioning error (This works as per the implementation). Because of this user's operations are getting delayed and they have to repeat same process until database allows update.

Is there anyway to allow updates from multiple transactions with optimistic versioning in place?

Venu
  • 303
  • 6
  • 21
  • 1
    Please add a language tag to this. Can you show some sample code? – Gray Jan 15 '13 at 21:58
  • Sorry, don't understand...aren't you contradicting yourself? Do you _want_ [optimistic locking](http://en.wikipedia.org/wiki/Optimistic_locking) or not? – Marcel Stör Jan 16 '13 at 20:11
  • +1 @MarcelStör you are contradicting yourself. Please review and state your objective behind using optimistic locking in the first place. Does it matter that users are overwriting each other? If no, then remove the optimistic lock (version attribute). If yes, then ask the users to deal with it. If the updates are mutually exclusive then write them to a child-table and display the aggregates. – Καrτhικ Jan 16 '13 at 20:35
  • @MarcelStör I want optimistic locking. – Venu Jan 16 '13 at 20:58
  • @kabram users shouldn't overwrite each other, that's the reason we have optimistic locking in place. only issue here is from operations point. – Venu Jan 16 '13 at 21:01
  • Could you read this thread: http://stackoverflow.com/questions/10119787/optimistic-locking-in-hibernate-by-default and maybe add more info about what you are after. – JoeG Mar 04 '13 at 20:12

0 Answers0