Today, the same data can be found in case-insensitive input conditions when querying data. For example, if you enter aaa, aaA, or AAA to query the same results, the query conditions are case-insensitive. Because the program uses the hibernate framework to access the mysql database. At first, I thought it was a problem with hibernate. After tracing the hibernate code, we did not see the case-insensitive conversion step. Finally, we confirmed that hibernate only converts hql to SQL. The case sensitivity is irrelevant to hibernate. Therefore, I suspect Mysql problems. Make an experiment: directly use the client to query the database using SQL. It is found that the size is not sensitive. You need to set collate by querying the data ). Collate rule: * _ bin: Indicates binary case sensitive collation, that is, case sensitive * _ cs: case sensitive collation, case sensitive * _ ci: case insensitive collation, case-insensitive www.2cto.com solution. 1. query conditions can be included in binary. For example: select * from TableA where columnA like binary ('aaa'); 2. you can MODIFY the collation of this field to binary, for example, alter table tablename modify column columnname varchar (50) binary character set utf8 COLLATE utf8_bin default null. The problem is solved.
Author directed