oracle+mybatis报错:BindingException("Invalid bound statement (not found): ")
oracle+mybatis报错:BindingException("Invalid bound statement (not found): ")
从mysql转到oracle数据库:原来mysql保存数据的时候有的字段可以是Null值得,到了oracle里面,字段为null会报错。
于是乎使用了mybatis-plus插件。
在保存数据是email字段是可以为空的。
@TableField(value="EMAIL", el="email, jdbcType=VARCHAR")
private String email;
结果导致报错:
BindingException("Invalid bound statement (not found): ")
需要在映射mapper的sql方法上增加@Flush注解
@Repository
public interface ISysDictMapper extends IBaseMapper<SysDictPO> { @Flush
List<SysDictPO> queryAvailableDict();
}
可以增加配置项:https://blog.csdn.net/qq_21747795/article/details/81217264
解决方法:请将mybatis-plus改成mybatis,mybatis,mybtis,重要的说三遍,
必要的架包如下
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring- boot-starter</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>2.1.9</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-autoconfigure</artifactId>
<version>1.3.2</version>
</dependency>
注意第一个是mybatis-spring-boot-start ,不是mybatisplus-spring-boot-start
还要在mybatis配置文件里声明MybatisSqlSessionFactoryBean,至此问题解决
@Configuration
public class MybatisPlusConfig {
@Autowired
private DataSource dataSource; @Autowired
private MybatisProperties properties; @Autowired
private ResourceLoader resourceLoader = new DefaultResourceLoader(); @Autowired(required = false)
private Interceptor[] interceptors; @Autowired(required = false)
private DatabaseIdProvider databaseIdProvider; /**
* mybatis-plus分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor page = new PaginationInterceptor();
page.setDialectType("mysql");
return page;
}
/**
* 这里全部使用mybatis-autoconfigure 已经自动加载的资源。不手动指定
* 配置文件和mybatis-boot的配置文件同步
* @return
*/
@Bean
public MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean() {
MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean();
mybatisPlus.setDataSource(dataSource);
mybatisPlus.setVfs(SpringBootVFS.class);
if (StringUtils.hasText(this.properties.getConfigLocation())) {
mybatisPlus.setConfigLocation(this.resourceLoader.getResource(this.properties.getConfigLocation()));
}
mybatisPlus.setConfiguration(properties.getConfiguration());
if (!ObjectUtils.isEmpty(this.interceptors)) {
mybatisPlus.setPlugins(this.interceptors);
}
MybatisConfiguration mc = new MybatisConfiguration();
mc.setDefaultScriptingLanguage(MybatisXMLLanguageDriver.class);
mybatisPlus.setConfiguration(mc);
if (this.databaseIdProvider != null) {
mybatisPlus.setDatabaseIdProvider(this.databaseIdProvider);
}
if (StringUtils.hasLength(this.properties.getTypeAliasesPackage())) {
mybatisPlus.setTypeAliasesPackage(this.properties.getTypeAliasesPackage());
}
if (StringUtils.hasLength(this.properties.getTypeHandlersPackage())) {
mybatisPlus.setTypeHandlersPackage(this.properties.getTypeHandlersPackage());
}
if (!ObjectUtils.isEmpty(this.properties.resolveMapperLocations())) {
mybatisPlus.setMapperLocations(this.properties.resolveMapperLocations());
}
return mybatisPlus;
}
}
oracle+mybatis报错:BindingException("Invalid bound statement (not found): ")的更多相关文章
- mybatis报错:Invalid bound statement (not found)
mybatis报错:Invalid bound statement (not found)的原因很多,但是正如报错提示一样,找不到xml中的sql语句,报错的情况分为三种: 第一种:语法错误 Java ...
- Springboot项目下mybatis报错:Invalid bound statement (not found)
mybatis报错:Invalid bound statement (not found)的原因很多,但是正如报错提示一样,找不到xml中的sql语句,报错的情况分为三种: 第一种:语法错误 Java ...
- mybatis 报错: Invalid bound statement (not found)
错误: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): test.dao.Produc ...
- MyBatis绑定错误--BindingException:Invalid bound statement (not found)
如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...
- SpringBoot报错:Invalid bound statement (not found)
错误原因: 没有发现Mybatis配置文件的路径 解决方法: 检查Mapper包名与xml文件标签的namespace数据名称是否相同 <mapper namespace="com.t ...
- idea报错:Invalid bound statement (not found)
在配置MyBatis接口映射的Mapper.xml时,提示Invalid bound statement (not found)异常,就算是接口和xml名字相同,路径相同也无法找到,在网上找到了几种解 ...
- 项目报错:Invalid bound statement (not found):
出现这种错误有好多种情况,常见的错误有以下这些: 1.检查xml文件所在package名称是否和Mapper interface所在的包名 <mapper namespace="com ...
- IDEA报错: Invalid bound statement (not found): com.test.mapper.UserMapper.selectByPrimaryKey(转发:https://www.cnblogs.com/woshimrf/p/5138726.html)
学习mybatis的过程中,测试mapper自动代理的时候一直出错,在eclipse中可以正常运行,而同样的代码在idea中却无法成功.虽然可以继续调试,但心里总是纠结原因.百度了好久,终于找到一个合 ...
- spring boot报错:Invalid bound statement (not found): com.
经检查发现mapper的namespace没写全导致的 正确应该写成这样就可以了:
- mybatis替换成mybatisplus后报错mybatisplus Invalid bound statement (not found):
项目原来是mybatis,之后由于生成代码不方便,觉得替换成mybatisplus,引入mybatisplus后,启动项目报错mybatisplus Invalid bound statement ( ...
随机推荐
- 【转帖】微软全新Windows 10X细节一览
微软全新Windows 10X细节一览 https://www.cnbeta.com/articles/tech/906241.htm windows NT之后 又一大改进 今年的Surface发布会 ...
- Word 自带公式使用方法技巧(11)
1. 快捷命令 在Word中输入「Alt+=」,可以打开Word中自带公式编辑器.这个编辑器似乎没有什么特别,但其实 Word 2010 以后是支持 LaTeX 语法的.常用规则如下: 分号: a/b ...
- Python之 time 模块
时间模块的转换关系与方式: #!/usr/bin/env python # -*- coding:utf8 -*- import time # 时间戳 print('\ntime.time() --& ...
- 存储库之MongoDB
一.简介 MongoDB是一款强大.灵活.且易于扩展的通用型数据库(非关系型数据库) 1.易用性 MongoDB是一个面向文档(document-oriented)的数据库,而不是关系型数据库. 不采 ...
- GC收集器
新生代收集器 Serial New 单线程收集器,工作时必须暂停其他线程: 简单高效,没有线程交互开销: 基于复制算法: Parallel New 对Serial的改进,多线程: CPU数量<4 ...
- TweenLite参数用法中文介绍
TweenLite是一个缓动的类包,功能强大,并且易于使用,为了更多的(E文欠佳的.初学的)朋友了解它,使用它,特此翻译了一下TweenLite类文档中的说明文件,主要是对参数的说明,希望对大家有用. ...
- git学习笔记 ---管理修改
现在,假定你已经完全掌握了暂存区的概念.下面,我们要讨论的就是,为什么Git比其他版本控制系统设计得优秀,因为Git跟踪并管理的是修改,而非文件. 你会问,什么是修改?比如你新增了一行,这就是一个修改 ...
- go 基本IO接口
package main import ( "fmt" "io" "strings" ) func ReadFrom(reader io.R ...
- redis订阅与发布系统
一.概述 1.redis通过publish.subscribe等命令实现了订阅与发布模式. 2.这个功能提供两种信息机制,分别是订阅/发布到频道和订阅/发布到模式. 二.频道的订阅与信息发送 1.re ...
- 基于node.js 的 websocket的移动端H5直播开发
这一篇介绍一下基于node.js 的 websocket的移动端H5直播开发, 下载文章底部的源码,我是用vscode打开, 首先在第一个终端运行 npm run http-server 这个指令是运 ...