I use MyBatis to match some queries where I need to compare the argument String( myString).
My Mapper interface :
public Map<Integer, String> findSomething(@Param("myString") String myString);
My XML is as follows:
<select id="findSomething" parameterType="String" resultType="Map">
SELECT column1 as key,
column2 as value
FROM my_table
<where>
<choose>
<when test="myString == 'xxx'">
column3 = 1
</when>
<when test="myString == 'yyy'">
myColumn = 2
</when>
<when test="myString == 'zzz'">
myColumn = 3
</when>
</choose>
</where>
ORDER BY value;
</select>
When I execute this expression, the following error is thrown:
ERROR [stderr] Caused by: org.apache.ibatis.exceptions.PersistenceException:
ERROR [stderr] ### Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'myString' in 'class java.lang.String'
A Stringcomparison made in a way that smells bad. Unfortunately, this is how the database was modeled.
MyBatis version: 3.2.2
source
share