data insertion error
1. After doing sub-database and sub-table, it is now necessary to migrate the existing data of a single database to the corresponding sub-database and sub-table database
2. Data migration is to read the table structure information of the specified table, use 3. PreparedStatement, and use placeholders to splicing and submitting data
3. In order to prevent migration errors, migrate multiple times, clear the sharding table each time, and then migrate
4. During the migration, some errors were encountered, version 5.0
Report an error
Sharding value must implements Comparable
CommandExecutorTask - Exception occur:
java.lang.IllegalArgumentException: Sharding value must implements Comparable.
Causes and Solutions
1. A non-null field with a null value inserted
2. It may be the primary key. If the primary key policy is not set and it is not automatically generated, an error will be reported.
3. It may be the sub-database sub-table key, which cannot be null. This is my situation, the data is maintained, and the sub-database fields of all tables are assigned corresponding values, and the error is resolved
Error report 2
NoSuchElementException
org.postgresql.util.PSQLException: ERROR: java.util.NoSuchElementException
Causes and Solutions
1. The reason is that the number of inserted values does not match the number of table fields.
2. The first time I encountered this error, it was due to the use of sub-database sub-table and data encryption at the same time
3. The field configuration of data encryption affects the calculation and reading of the number of fields, resulting in the mismatch between fields and inserted values, resulting in an error. 4. After temporarily dropping the data encryption,Solved
4. The second time I encountered this error, I found that the structure of the original table was changed, and 2 fields were added. The table structure of the sub-database and sub-tables has not changed, resulting in the field value and quantity not corresponding to each other. Maintain the table structure of the sub-database and sub-tables After that, solve it (the problem is that after adding the field, it will not take effect without restarting sharding-proxy)
Read More:
- javaweb Connect Datas Error: che.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1444)
- [How to Solve]Repeated column in mapping for entity,should be mapped with insert=“false“ update=“false“
- [Solved] mybatis plus Insert Error: mybatis plus Error setting null for parameter #1 with JdbcType OTHER
- [Solved] Mybatis insert Error: Cause: java.sql.SQLException: SQL String cannot be empty
- 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)
- [Solved] java.lang.IllegalAccessError: class org.springframework.data.redis.core.$ Proxy237 cannot access its superinterface org.springframework.data.redis.core.RedisConnectionUtils$RedisConnectionProxy
- Mybatis sets the primary key Auto-Increment error: No setter found for the keyProperty
- [Solved] Flyway Error: Detected applied migration not resolved locally:2 and the execution script error
- Hibernate Error: Error executing DDL “create table course (xxx)“
- [Solved] ClickHouse Error: Code: 62. DB::Exception: Syntax error (Multi-statements are not allowed): fai
- How to Solve the Primary Key of mybatisPlus Inserted Data is too Large Issue
- Idea2022 automatic generate poji error [How to Solve]
- ERROR 1046 (3D000): No database selected [How to Solve]
- [Solved] Swagger request error: error:getaddrinfo ENOTFOUND
- org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deseria
- Using mybatis statement.getGenreatedKeys(); usegeneratedkeys = “true”; using self incrementing primary key to get primary key value policy and Oracle do not support self incrementing, Oracle uses sequence
- [Solved] IDEA JPA Custome Query Error: Can‘t resolve symbol ‘Type‘
- [Solved] Specified key was too long; max key length is 767 bytes
- [Solved] seata Error: io.seata.rm.datasource.exec.LockConflictException: get global lock fail, xid:xxx, lockKeys:xxx
- [Solved] Nacos1.3.2 Startup Error: Unable to start embedded Tomcat