How do we write sql queries which has bit wise operators in mybatis mapper xml. I have a query which has bitwise operator AND (&) in the where clause.
WHERE id=1000 AND NOT status&4 AND NOT status&16 ; //This is the where clause of the query.
id and status are columns of the table. status column is INT data type. When i write this query in mybatis mapper file it shows an error for the & operator? and when application runs throws an exception
org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance
Since you're writing the query in an XML file, you should escape the ampersand character using &
.
Your queries should look like this
WHERE id=1000 AND NOT status&4 AND NOT status&16
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.