背景
项目中使用雪花id,id一直为null(空指针异常)
报错信息:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.lang.NullPointerException
### The error may exist in edu/znzz/easypoint/dao/DishesTasteMapper.java (best guess)
### The error may involve edu.znzz.easypoint.dao.DishesTasteMapper.insert
### The error occurred while executing an update
### Cause: java.lang.NullPointerException
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy93.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
报错截图
解决
数据库字段
数据库字段主键为bigint
java数据类型
显然这里错了