【NOOB】MyBatis-Plus 的 SaveBatch报错空指针

Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@789d1b54] from current transaction
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@789d1b54]
Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@789d1b54]
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@789d1b54]
2022-04-26 17:27:46.741 ERROR 15828 --- [io-19004-exec-2] n.y.c.config.GlobalExceptionHandler      : org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.lang.NullPointerException
### The error may exist in *******/*******/*******/mapper/*********.java (best guess)
### The error may involve *******.*******.*******.mapper.*******.updateById
### 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.$Proxy143.update(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:288)
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:64)

我出现这个的情况是因为我们的权限框架有问题,

 

自动填充的PO字段填充获取userName的时候报了空指针

你可以把你们项目的获取username的方法注释掉或者返回一个默认值试一试,看是不是同样的原因.

相应的你可以检查一下其他PO自动填充的字段是否有问题

我还在其他帖子见到,如果表的列[VARCHAR(10)]长度短于insert的字段长度也会报空指针.

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值