I am using Roo 1.0.2.
If I call merge() on an entity twice (for instance pressing save button twice in gui) I get a
org.springframework.orm.jpa.JpaOptimisticLockingFa ilureException: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction
The entity has not changed or been updated by another.
If I try to simulate it in a test:
Person p = new Person();
org.springframework.dao.DataIntegrityViolationExce ption: org.hibernate.exception.ConstraintViolationExcepti on: could not insert: [Person]; nested exception is javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationExcepti on: could not insert: [Person]
So I try another simulation
The I get the JpaOptimisticLockingFailureException but not until line 10.
1 Person p = new Person();
4 p = p.findPerson(p.getId());
Can anybody explain to me what is going on here and how to fix this?