Mybatis_plus 出现 MP_OPTLOCK_VERSION_ORIGINAL
乐观锁问题
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘MP_OPTLOCK_VERSION_ORIGINAL’ not found. Available parameters are [param1, et]
描述:mybatis_plus版本太新出现的问题,老版本使用的OptimisticLockerInterceptor 新版本使用的OptimisticLockerInnerInterceptor
方法1:
@Bean
public OptimisticLockerInterceptor myOptimisticLockerInnerInterceptor(){
return new OptimisticLockerInterceptor();
}
方法2:
@Bean
public OptimisticLockerInnerInterceptor myOptimisticLockerInnerInterceptor(){
return new OptimisticLockerInnerInterceptor();
}
修改为
@Bean
public MybatisPlusInterceptor myOptimisticLockerInnerInterceptor(){
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}