MyBatis version
3.5.14
Database vendor and version
Mysql 8.0.29
Test case or example project
https://github.com/yudarer/demo.git
Steps to reproduce
I have a POJO class named Info, which has the fields id and band. I encountered an exception when using dynamic SQL insertion: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'band!=null'. When I debugged the code, I found that there was a problem with the method org.apache.ibatis.ognl.Ognl#parseExpression. However, when I changed the entity field to bandName, it could be saved without any exceptions. Could you run my sample code, you will see the exception occurs.
Expected result
use field band can save it no exception
Actual result
MyBatisSystemException
Comment From: harawata
Hello @yudarer ,
Please post the CREATE TABLE
statement for the info
table.
Also, when reporting an exception, it is important to include the entire stack trace.
Comment From: harawata
The issue you reported probably is the known limitation of OGNL.
- https://github.com/orphan-oss/ognl/blob/main/docs/LanguageGuide.md#limitations
- https://github.com/orphan-oss/ognl/issues/103
Only or
is mentioned there, but and
is the same, I think.
One workaround is to reference the parameter as _parameter['band']
instead of band
.
I'll close this as there is nothing we can do in MyBatis side.