org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.NumberFormatException: For input string: "W%" ### Cause: java.lang.NumberFormatException: For input s
一个常见的myBatis xml文件中的引号错误:
org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.NumberFormatException: For input string: "W%" ### Cause: java.lang.NumberFormatException: For input string: "W%" at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) at com.sun.proxy.$Proxy6.copyUserByDynamicSql(Unknown Source) at com.test.TestUser.testCopyUserByDynamicSql(TestUser.java:116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: java.lang.NumberFormatException: For input string: "W%" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.lang.Double.parseDouble(Double.java:538) at org.apache.ibatis.ognl.OgnlOps.doubleValue(OgnlOps.java:243) at org.apache.ibatis.ognl.OgnlOps.compareWithConversion(OgnlOps.java:100) at org.apache.ibatis.ognl.OgnlOps.isEqual(OgnlOps.java:143) at org.apache.ibatis.ognl.OgnlOps.equal(OgnlOps.java:802) at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:53) at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258) at org.apache.ibatis.ognl.ASTAnd.getValueBody(ASTAnd.java:61) at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258) at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:470) at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:434) at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:44) at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:32) at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:34) at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:33) at org.apache.ibatis.scripting.xmltags.TrimSqlNode.apply(TrimSqlNode.java:55) at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:33) at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:41) at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:292) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ... 30 more |
简单的来看传入参数的字符串有问题,但是检查多边后字符串还是没问题,其实问题是习惯造成的,一般大家都有习惯在有引号嵌套的时候在外面使用"" ,在里面使用'' ,这就是问题所在,下面是错误的代码:
<if test= "username != null and username != ' ' ">
将其改为
<if test= 'username != null and username != " " ' >
再次测试则没有问题了。
org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.NumberFormatException: For input string: "W%" ### Cause: java.lang.NumberFormatException: For input s的更多相关文章
- org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manu
这个是sql 语句 错误 仔细检查 SQL语句是否写错了 org.apache.ibatis.exceptions.PersistenceException: ### Error queryi ...
- org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent succ
数据库 没有开启 连接失败 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause ...
- mybatis <fireach> 拼接sql语句 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'in'. Cause:
<select id="getUserIn" parameterType="QueryVo" resultMap="userMap"& ...
- org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents mor
今天在用junit测试mybits程序是遇到一个问题,报错为: org.apache.ibatis.exceptions.PersistenceException: ### Error queryin ...
- 使用Mybatis连接数据库时报错:org.apache.ibatis.exceptions.PersistenceException: ### Error updating database.
我的原因是字段名写错了,去数据库中复制字段名再运行就成功了.
- MyException--org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ###
org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may ...
- Mybatis-java.lang.RuntimeException: org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may exist in sqlmap/User.xml ### Cause: org.apache.ibatis.builder.B
mappers(映射器) 使用相对于类路径的资源 如:<mapper resource="sqlmap/User.xml" /> 使用完全限定路径 如:<mapp ...
- MyBatis-Exception:org.apache.ibatis.exceptions.PersistenceException
错误信息如下: HTTP Status 500 - org.mybatis.spring.MyBatisSystemException: nested exception is org.apache. ...
- mybatis bug之org.apache.ibatis.exceptions.PersistenceException:
详细报错信息: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java. ...
随机推荐
- Codeforces 932 数组环构造 树上LCA倍增
A #include <bits/stdc++.h> #define PI acos(-1.0) #define mem(a,b) memset((a),b,sizeof(a)) #def ...
- c++ 创建线程用CreateThread后,线程直接就开始执行了吗
//CreateThread函数的参数原型如下 HANDLE CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD SIZE_T ...
- Django【第11篇】:Django之分页升级版本(组件)
分页组件 一.分页的实现与使用 class Pagination(object): """ 自定义分页 """ def __init__(s ...
- Git提交代码的正确姿势
按此步骤基本没问题,中间有conflict,需要手动解决. 1.git stash 2.git pull 3.git stash pop 4.git add --xxx 5.git commit -m ...
- mysql查看内存使用情况
SELECT table_name '表名称',table_rows '数据量(万)',data_size '磁盘(G)'FROM (SELECT table_name table_name, tru ...
- java调用存储过程的方式
1.问号是入参和出参,出参要指定类型 CallableStatement pstmt = conn.prepareCall("{call dbo.UP_CodeUp_***(?,?,?,?, ...
- Java——常用类(File)
[File] <1>java.io.File类代表系统文件名(路径和文件名). ----注意:这里代表的只是文件名,而不是物理上的文件(硬盘上的数据),通过该类无法读 ...
- 给网页头部标题加logo
现在在写公司的官网,需要在网页的头部加logo,没有加的时候是这样的 那么,现在只要一步,就可以了,加上一行代码 <link rel="icon" href="图标 ...
- Windows 搭建Hadoop 2.7.3开发环境
1.安装配置Java环境 1.1.安装Windows版本的jkd应用程序 当前的系统环境是64位Windows 7,因此下载64位JDK,下载地址:http://download.oracle.com ...
- [CSP-S模拟测试]:计数(DP+记忆化搜索)
题目描述 既然是萌萌哒$visit\text{_}world$的比赛,那必然会有一道计数题啦!考虑一个$N$个节点的二叉树,它的节点被标上了$1\sim N$的编号.并且,编号为$i$的节点在二叉树的 ...