• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate @Version field error.

 
Nirmal Jatania
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using hibernate, spring, struts framework for my application.

In my application, each of the table has one field called as Version for tracking updation of any records.

Whenever i am updating existing record of my Country table which has version 0, it works fine & update the record update the version field to 1.

But whenever i am trying to update that version 1 record, it gives me error as follows:



org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [com.sufalam.business.marketing.model.bean.Country] with identifier [3]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.sufalam.business.marketing.model.bean.Country#3]



Is there any way to resolve it ?
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Check out this post

http://www.coderanch.com/t/218700/Object-Relational-Mapping/java/Issue-with-saving-pojo-transactional
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic