insert时没有生成id
@Test public void insert(){ User user = new User(); user.setName("tom"); user.setManagerId(1088248166370832385L); user.setCreateTime(new Date()); int insert = userMapper.insert(user); System.out.println("insert = " + insert); }
org.springframework.dao.DataIntegrityViolationException:
### Error updating database. Cause: java.sql.SQLException: Field 'id' doesn't have a default value
### The error may exist in com/exam/demo/mapper/UserMapper.java (best guess)
### The error may involve com.exam.demo.mapper.UserMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO user ( name, manager_id, create_time ) VALUES ( ?, ?, ? )
### Cause: java.sql.SQLException: Field 'id' doesn't have a default value
; Field 'id' doesn't have a default value; nested exception is java.sql.SQLException: Field 'id' doesn't have a default value