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:
- org.hibernate.exception.SQLGrammarException: could not extract ResultSet, Resolve MySQL 5.7.5 or above GROUP_BY is not supported
- [Solved] org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.exception
- keytool error java.io.IOException:keystore was tampered with,or password was incorre
- 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)
- keytool Error: java.io.IOException: Keystore was tampered with, or password was incorrect
- Hibernate Error: Error executing DDL “create table course (xxx)“
- Spring Error: Transaction synchronization is not active
- [Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)
- [Solved] java.sql.SQLException: Table ‘xxx.hibernate_sequence’ doesn’t exist
- [Solved] Java POI export error: Invalid row number (65536) outside allowable range
- [Solved] Error resolving template [x] template might not exist or might not be accessible by any of the con
- [Solved] Kafka in Windows error:java. nio. file. Filesystemexception: this file is in use by another program and cannot be accessed by the process
- [Solved] Java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_it
- How to Open Files by Dragging and Dropping in C#
- mybatis “case when” Error: Failed to process, please exclude the tableName or statementId.
- Asynchronous processing of HTTP request by Java_ Method 2: through deferredresult
- Asynchronous processing of HTTP request by Java_ Method 1: through callable
- Project Startup Error: It was loaded from the following location
- [Solved] IO exception: NL exception was generated
- [Solved] ssm Error: Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed