首页 > 数据库 >mybatis动态sql将字符串转换成数字类型报错

mybatis动态sql将字符串转换成数字类型报错

时间:2023-12-08 15:58:12浏览次数:42  
标签:java spring 报错 sql mybatis org

报错信息

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
	### Error querying database.  Cause: java.lang.NumberFormatException: For input string: "xxx"
	### Cause: java.lang.NumberFormatException: For input string: "xxx"
	java.util.concurrent.CompletionException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

解决办法

  • 1、外面使用单引号,参数使用双引号
<if test='test == "xxx" '>

</if>
  • 2、加toString()方法
<if test="test == 'xxx'.toString()">

</if>

标签:java,spring,报错,sql,mybatis,org
From: https://www.cnblogs.com/fchhk-blog/p/17888313.html

相关文章

  • 如何解决yum安装软件时报错This system is not registered with an entitlement serve
    RedHat、基于redhat源代码所编译的centos都会遇到这种问题,红帽需要对当前的系统进行注册后才能使用yum安装软件,解决方法多种多样,如直接注册+订阅/换yum源/干掉RedHatSubscriptionManager订阅管理器解决方法:这里介绍最简单的一种:禁用RedHatSubscriptionManager订阅管理......
  • Redis报错:(error) DENIED Redis is running in protected mode because protected mod
    一、报错内容  (error)DENIEDRedisisrunninginprotectedmodebecauseprotectedmodeisenabledandnopasswordissetforthedefaultuser.Inthismodeconnectionsareonlyacceptedfromtheloopbackinterface.Ifyouwanttoconnectfromexternal......
  • SQL无法解决排序规则 Chinese_PRC_CI_AS 和 Latin1_General_CI_AS 的冲突
    最近在执行一些跨库关联查询语句的时候提示了“Cannotresolvethecollatiorconflictbetween"Chinese_PRC_CiAs"and"soLLatini_General_CPi_CiAs"intheequaltolperatn”的错误,查询整理一下相关资料如下:排序规则排序规则指定表示数据集中每个字符的位模式。排序......
  • Spring源码系列:MyBatis整合和原理
    前言Mybatis是啥?Mybatis是一个支持普通SQL查询、存储过程以及映射的一个持久层半ORM框架。那么在了解Spring整合Mybatis这部分源码之前,我们先来看下Mybatis的实际运用。一.Mybatis的使用首先,项目的结构如下:pom依赖:<dependency><groupId>org.mybatis</groupId><artifactId......
  • JetBrains DataGrip 2023.3 (macOS, Linux, Windows) - 数据库和 SQL 跨平台 IDE
    JetBrainsDataGrip2023.3(macOS,Linux,Windows)-数据库和SQL跨平台IDE请访问原文链接:https://sysin.org/blog/jb-datagrip-2023/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.orgJetBrainsDataGrip-多种数据库,一个工具为什么选择DataGrip轻松处理数据......
  • MySQL数据库-1
    MySQL数据库-11.为什么要使用数据库持久化(persistence):把数据保存到可掉电式存储设备中以供之后使用。大多数情况下,特别是企业级应用,数据持久化意味着将内存中的数据保存到硬盘上加以"固化”,而持久化的实现过程大多通过各种关系数据库来完成。持久化的主要作用是将内存中......
  • Mysql Full-Text Index 介绍
    MysqlFull-TextIndex介绍ngramFull-TextParser参考链接Thebuilt-inMySQLfull-textparserusesthewhitespacebetweenwordsasadelimitertodeterminewherewordsbeginandend,whichisalimitationwhenworkingwithideographiclanguagesthatdono......
  • Redis报错:WARNING: The TCP backlog setting of 511 cannot be enforced because /pro
    报错内容:1:C08Dec202305:47:33.348#oO0OoO0OoO0OoRedisisstartingoO0OoO0OoO0Oo1:C08Dec202305:47:33.348#Redisversion=7.0.5,bits=64,commit=00000000,modified=0,pid=1,juststarted1:C08Dec202305:47:33.348#Configurationloaded1:M08De......
  • SqlServer常用语句
    --添加表描述EXECUTEsp_addextendedproperty'C','课程表','user','dbo','table','Course',NULL,NULL;--添加字段描述EXECUTEsp_addextendedproperty'MS_Description','课程ID','us......
  • 公历日期转农历日期的SQL函数
       /*-------------------------------------------------------------------------------功能:返回指定日期的农历日期(需配合sys_date_lunar表使用)参数说明:@solarDay日期@type日期:0:年月日文本:1:月日的文本......