Critical: Servlet.service () for Servlets [spring] in context with path [] threw exception [Request processing failed; nested EXCE Ption is org.mybatis.spring.MyBatisSystemException:nested exception is Org.apache.ibatis.exceptions.PersistenceException:
# # # Error querying database. Cause:java.lang.IllegalArgumentException:invalid Comparison:java.util.Date and Java.lang.String
# # # Cause:java.lang.IllegalArgumentException:invalid Comparison:java.util.Date and java.lang.String] with root cause< /c0>
Java.lang.IllegalArgumentException:invalid Comparison:java.util.Date and Java.lang.String
At Org.apache.ibatis.ognl.OgnlOps.compareWithConversion (ognlops.java:93)
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)
。。。。
On the surface is because the type does not meet, but think, the date type corresponds to the MySQL datetime, as well as mapper in the Jdbctype all no problem ah. and the exact same thing is perfectly normal in the original project. Since it's all the same code, look for the two projects.
The first is a different version of the MySQL jar. It is not valid to replace the original project version. Then the MyBatis jar version is not the same, replaced by the original project version of the problem solved!
The original project was configured with mybatis-3.2.8, and I was using mybatis-3.3.1 in my test project. I later found it on the internet to find out why:
It turns out that this is a bug when comparing time parameters in MyBatis 3.3.0. If you compare an incoming time type argument to an empty string, the exception is thrown. So in the above code to go to the judgment, only the non-null judgment is normal
For example: in the Xxmapper.xml
<update id= "Updaccount" parametertype= "Com.isoftstone.ci.user.domain.Account" >
Update Usr_account Set
<trim suffixoverrides= "," >
<if test= "Sysaccounttype! = null" >
Sys_account_type=#{sysaccounttype},
</if>
<if test= "realnameauthed! = null" >
Real_name_authed=#{realnameauthed},
</if>
<if test= "Lastloginat! = null and Lastloginat! =" ">
Last_login_at=#{lastloginat}
</if>
</trim>
Where Id=#{id}
</update>
Replace the code with the following code (remove the comparison between time and empty string Lastloginat! = ")
<update id= "Updaccount" parametertype= "Com.isoftstone.ci.user.domain.Account" >
Update Usr_account Set
<trim suffixoverrides= "," >
<if test= "Sysaccounttype! = null" >
Sys_account_type=#{sysaccounttype},
</if>
<if test= "realnameauthed! = null" >
Real_name_authed=#{realnameauthed},
</if>
<if test= "Lastloginat! = null" >
Last_login_at=#{lastloginat}
</if>
</trim>
Where Id=#{id}
</update>
MyBatis Partial version exception invalid comparison:java.util.Date and java.lang.String