When doing the product upload function, we reported the error of cause: Java. SQL. Sqlexception: field ‘ID’ doesn’t have a default value (the main error is as follows). After query, it was caused by setting ID self growth in mapper.xml, but not in the database
Solutions:
Step 1: check whether my ID is int type, because I set string type, so I can’t find the self incrementing check box when using Navicat
public class FoodEntity {
/**
* Product ID
*/
@TableId
private String id; // set to String here, but it will still error out
// The auto-grow type is int
private int id
Step 2: open Navicat premium and click design table for the table to be operated
Step 3: check auto growth
Then restart the project to achieve the corresponding operation
Similar Posts:
- [Solved] Navicat Connect Oracle :Cannot load OCI DLL, 126
- [Solved] MySQL ERROR 1062 (23000): Duplicate entry ‘0’ for key ‘PRIMARY’
- The database returned no natively generated identity value [How to Solve]
- Greenplum Error: query plan with multiple segworker groups is not supported
- C# Unable to translate set operation when matching columns on both sides have different store types
- SQL0668N Operation not allowed for reason code “3” on table “TEST”. SQLSTAT…
- [Solved] C# The type or namespace name ‘DllImport’ could not be found
- React Native: Possible unhandled promise rejection request fail
- [Solved] Deploying Tomcat connection in Linux Navicat reports error 2059 – authentication plugin ‘caching_sha2_Password ‘cannot be loaded: + Xi input 9 g
- SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”