### Cause: java.sql.SQLException: Field 'id' doesn't have a default value

### Error updating database.  Cause: java.sql.SQLException: Field 'id' doesn't have a default value
### The error may involve com.bigaoread.platform.dao.beautifulreader.v2.activityexpress.ActivityADMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT  INTO  activity_ad          (          ad_name, ad_image, ad_url, ad_introduce, ad_order, create_time, update_time      )         VALUES         (?, ?, ?, ?,?, ?, ?)
### Cause: java.sql.SQLException: Field 'id' doesn't have a default value
; SQL []; Field 'id' doesn't have a default value; nested exception is java.sql.SQLException: Field 'id' doesn't have a default value

往往在实际项目中,向表中新增一条记录时,不会提供插入数据的id,然后直接让插入的数据对应字段值。

这里出现一个问题,意思是说没有提供字段id的值,但是并不说明提供的数据有问题,而实际原因是表字段id并不是自增长,所以需要修改数据库表字段id为自增长。

你可能感兴趣的:(数据库)