Mybatis : "less than" issue in Select annotations
Posted 遥望星空
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mybatis : "less than" issue in Select annotations相关的知识,希望对你有一定的参考价值。
I am using java7, spring 3 and mybatis
Pom.xml
<org.mybatis-version>3.2.8</org.mybatis-version>
<org.mybatis-spring-version>1.2.2</org.mybatis-spring-version>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${org.mybatis-version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${org.mybatis-spring-version}</version>
</dependency>
While using annotation based Select i came across with strange issue where below mentioned code was throwing exception due to use of < (Less then) while > (greater then) works as expected.
<script>
SELECT * FROM STUDENT
WHERE DEPARTMENT_ID = #{depId}
<if test=‘joiningDate != null‘> AND STUDENT_ID <= #{joiningDate} </if>
</script>
After googling for a while i find out this issue reported below.
https://code.google.com/p/mybatis/issues/detail?id=787
Above issue can be fixed by replacing < (less then) with <
as shown below.
<script>
SELECT * FROM STUDENT
WHERE DEPARTMENT_ID = #{depId}
<if test=‘joiningDate != null‘> AND STUDENT_ID <= #{joiningDate} </if>
</script>
I have also came across of suggestion for using using CDATA or ^ in respected scenarios which i haven‘t given try yet.
转自:http://www.itkeyword.com/doc/6200397421789202130/mybatis-less-than-issue-in-select-annotations
以上是关于Mybatis : "less than" issue in Select annotations的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode 1099. Two Sum Less Than K
LeetCode 713. Subarray Product Less Than K
ORA-20001:Password length less than 8
ORA-20001:Password length less than 8