Mybatis suddenly cannot find the data, and the query returns Null, but select count(*) from xxx query quantity, but the return is normal.
Preparing: SELECT id,a9004,a9005,a9015 FROM a90 where a9010 = ? ORDER BY id LIMIT 1
[DEBUG] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139):http-bio-8080-exec-7 - ==> Parameters: Tech Comments (String)
[DEBUG] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139):http-bio-8080-exec-7 - <== Total: 0
But sql:
SELECT id,a9004,a9005,a9015 FROM a90 where a9010 = 'Technology Review' ORDER BY id LIMIT 1
Execute directly in mysql.exe, but there are results.
Later I found out that it was a garbled problem, so I just need to specify the character encoding on the database connection:
?autoReconnect=true&useUnicode=true&characterEncoding=utf8
The above is the question of Mybatis's data that cannot be found and returned to Null, I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!