Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) Hibernate Error:
org.hibernate.StaleObjectStateException:Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
Error reporting reason:
1. The current version is not consistent with the db database version, the data is modified when the value of the form object in the version and the value of the corresponding record in the database version is not consistent, which makes the update method in the call, the version is not consistent with the reverse error.
2. Two or more sessions have modified the same record
Encountering such an exception indicates that the object of the operation uses an optimistic lock or the defined POJO defines the version field
Solution:
1. When submitting the form data, submit the version as well
2. First query the value of the version of the corresponding record in the database and assign it to the entity object to be modified, and then execute the update operation (after modifying the database data, the value of its version will change, so at this time the update operation needs to obtain the latest version value, assign it to the operation object, and then execute the update operation)
Read More:
- [How to Solve]Repeated column in mapping for entity,should be mapped with insert=“false“ update=“false“
- How to Solve Error executing DDL in JPA
- [Solved] The Bean Validation API is on the classpath but no implementation could be found
- [Solved] MongoDB Error: Command failed with error 251 (NoSuchTransaction)
- Java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver [How to Solve]
- When the database table field is set to self incrementing, use the entity class to insert or update the data to solve the error (Hibernate Framework)
- Hibernate Error: Error executing DDL “create table course (xxx)“
- How to Open Files by Dragging and Dropping in C#
- Mybatis reports an error (error building sqlsession.) when using annotations without deleting redundant files
- mybatis “case when” Error: Failed to process, please exclude the tableName or statementId.
- [Solved] org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.exception
- [Solved] springCloud Startup Error: Error creating bean with name ‘defaultValidator‘ defined in class path resource
- [Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)
- [Solved] Error creating bean with name ‘entityManagerFactory‘ defined in class path resource
- [Solved] Seata Error: endpoint format should like ip:port
- org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deseria
- Mapper.xml Error: Error setting non null for parameter #3 with JdbcType null.
- [Solved] IDEA Start Porject Error: java: Compilation failed: internal java compiler error
- Mybatis sets the primary key Auto-Increment error: No setter found for the keyProperty
- Spring Error: Transaction synchronization is not active