当前位置:网站首页>You have an error in your SQL syntax; use near ‘and title=‘xxx‘‘ at line 5
You have an error in your SQL syntax; use near ‘and title=‘xxx‘‘ at line 5
2022-06-12 08:30:00 【Dyansts】
Error details :
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and title=' Microservices '' at line 5
### The error may exist in com/wang/dao/BlogMapper.xml
### The error may involve com.wang.dao.BlogMapper.queryBlogIF-Inline
### The error occurred while setting parameters
### SQL: select * from blog where 1=1; and title=?
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and title=' Microservices '' at line 5
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:153)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at com.sun.proxy.$Proxy6.queryBlogIF(Unknown Source)
at Mytest.queryBlogIF(Mytest.java:54)
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:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and title=' Microservices '' at line 5
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:371)
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.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy8.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151)
... 33 moresolve
<!-- Error code -->
<select id="getQuery" parameterType="map" resultType="users">
select *
from loges
where 1=1;
<if test="title != null">
and title=#{title}
</if>
<if test="author != null">
and author=#{author}
</if>
</select>
<!-- After modification -->
<select id="getQuery" parameterType="map" resultType="users">
select *
from loges
where 1=1
<if test="title != null">
and title=#{title}
</if>
<if test="author != null">
and author=#{author}
</if>
</select>
It doesn't seem to change much , But one ; No. 1 determines life and death , I made a mistake easily
And then it says if Not included
边栏推荐
- (P19-P20)委托构造函数(代理构造函数)和继承构造函数(使用using)
- 【指针进阶三】实现C语言快排函数qsort&回调函数
- (p33-p35) lambda expression syntax, precautions for lambda expression, essence of lambda expression
- ctfshow web4
- Installation of Shengxin R package
- Vscode 调试TS
- MES系统是什么?MES系统的操作流程是怎样?
- 深拷贝与浅拷贝的区别
- 余压监控系统保证火灾发生时消防疏散通道的通畅,为大型高层建筑的安全运行和人民生命财产安全保驾护航
- Scope of bean
猜你喜欢

ASP. Net project development practice introduction_ Item VI_ Error report (summary of difficult problems when writing the project)

FDA reviewers say Moderna covid vaccine is safe and effective for children under 5 years of age

Website colab and kaggle

Hands on learning and deep learning -- simple implementation of linear regression

Beidou satellite navigation system foundation part 1

Py & go programming skills: logic control to avoid if else

MES系统质量追溯功能,到底在追什么?

ctfshow web3

Map the world according to the data of each country (take the global epidemic as an example)

Where does the driving force of MES system come from? What problems should be paid attention to in model selection?
随机推荐
工厂的生产效益,MES系统如何提供?
What is the MES system? What is the operation process of MES system?
Map the world according to the data of each country (take the global epidemic as an example)
Instructions spéciales pour l'utilisation du mode nat dans les machines virtuelles VM
Hands on deep learning 18 -- model selection + over fitting and under fitting and code implementation
(p33-p35) lambda expression syntax, precautions for lambda expression, essence of lambda expression
Calling stored procedures in mysql, definition of variables,
How to write simple music program with MATLAB
企业上MES系统的驱动力来自哪里?选型又该注意哪些问题?
ctfshow web 1-2
(p36-p39) right value and right value reference, role and use of right value reference, derivation of undetermined reference type, and transfer of right value reference
ctfshow web3
Seurat package addmodulescore is used for bulk RNA SEQ data
ERP的生产管理与MES管理系统有什么差别?
R loop assignment variable name
ctfshow web4
GTEST/GMOCK介绍与实战
智能制造的时代,企业如何进行数字化转型
The era of post MES system has come gradually
js中的正则表达式