mybatis:org.apache.ibatis.ognl.ParseException: Encountered " "OR "" at line 1, column 26错误解决

There is a sql made to list the collection sentenced to do air operations, sql follows mybatis project:

<IF the Test = "personnelHasList == null OR personnelHasList.size == 0">
1
Run Project found that from time to time when you receive the following error conditions:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression ‘personnelHasList == null OR personnelHasList.size == 0’. Cause: org.apache.ibatis.ognl.ExpressionSyntaxException: Malformed OGNL expression: personnelHasList == null OR personnelHasList.size == 0 [org.apache.ibatis.ognl.ParseException: Encountered ” “OR “” at line 1, column 26. 
Was expecting one of: 

“,” … 
“=” … 
“?” … 
“||” … 
“or” … 
“&&” … 
“and” … 
“|” … 
“bor” … 
“^” … 
“xor” … 
“&” … 
“band” … 
“==” … 
“eq” … 
“!=” … 
“neq” … 
“<” … 
“lt” … 
“>” … 
“gt” … 
“<=” … 
“lte” … 
“>=” … 
“gte” … 
“in” … 
“not” … 
“<<” … 
“shl” … 
“>>” … 
“shr” … 
“>>>” … 
“ushr” … 
“+” … 
“-” … 
“*” … 
“/” … 
“%” … 
“instanceof” … 
“.” … 
“(” … 
“[” … 
… 
]] with root cause 
org.apache.ibatis.ognl.ParseException: Encountered ” “OR “” at line 1, column 26. 
Was expecting one of: 

“,” … 
“=” … 
“?” … 
“||” … 
“or” … 
“&&” … 
“and” … 
“|” … 
“bor” … 
“^” … 
“xor” … 
“&” … 
“band” … 
“==” … 
“eq” … 
“!=” … 
“neq” … 
“<” … 
“lt” … 
“>” … 
“gt” … 
“<=” … 
“lte” … 
“>=” … 
“gte” … 
“in” … 
“not” … 
“<<” … 
“shl” … 
“>>” … 
“shr” … 
“>>>” … 
“ushr” … 
“+” … 
“-” … 
“*” … 
“/” … 
“%” … 
“instanceof” … 
“.” … 
“(” … 
“[” … 

Check online beginning this error message, the adoption of such a statement: There is not a legitimate symbol,  
resulting in xml parsing unsuccessful. So copied from other xml file can be run through in a number == found  
really successful operation, when time is running out, there are other tasks at hand, careful to verify there is no more than  
a few times, if verified more than a few times, it will find practical problems still exist (that I still have yet  
to understand why the beginning can run successfully), then I will try "oR" change "or" change and  
will "||", not found problem, initially determined that the cause mybatis does not recognize the uppercase OR. AND not be capitalized
--------------------- 
Author: caidie_huang 
Source: CSDN 
Original: https: //blog.csdn.net/caidie_huang/article/details/ 81539466 
copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin blog.csdn.net/Amelia__Liu/article/details/94732897