diff --git a/CHANGELOG.md b/CHANGELOG.md index b951f4175..7e56b43c3 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ * 【core 】 修复DateUtil.parse 给定一个时间解析错误问题(issue#I7QI6R@Gitee) * 【core 】 去除默认的ACCEPT_LANGUAGE(issue#3258@Github) * 【core 】 修复FieldsComparator比较结果不正确问题(issue#3259@Github) +* 【core 】 修复Db.findAll全局忽略大小写无效问题(issue#I7T30Y@Gitee) ------------------------------------------------------------------------------------------------------------- # 5.8.21(2023-07-29) diff --git a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java b/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java index beee6c8a4..a5069aff1 100755 --- a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java +++ b/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java @@ -624,7 +624,7 @@ public abstract class AbstractDb implements Serializable { * @throws SQLException SQL执行异常 */ public List findAll(Entity where) throws SQLException { - return find(where, EntityListHandler.create()); + return find(where, new EntityListHandler(this.caseInsensitive)); } /** diff --git a/hutool-db/src/test/java/cn/hutool/db/CRUDTest.java b/hutool-db/src/test/java/cn/hutool/db/CRUDTest.java index d81502707..3a357fa7e 100644 --- a/hutool-db/src/test/java/cn/hutool/db/CRUDTest.java +++ b/hutool-db/src/test/java/cn/hutool/db/CRUDTest.java @@ -108,7 +108,7 @@ public class CRUDTest { @Test public void findTest() throws SQLException { - List find = db.find(CollUtil.newArrayList("name AS name2"), Entity.create("user"), new EntityListHandler()); + List find = db.find(CollUtil.newArrayList("name AS name2"), Entity.create("user"), EntityListHandler.create()); Assert.assertFalse(find.isEmpty()); } diff --git a/hutool-db/src/test/java/cn/hutool/db/ConcurentTest.java b/hutool-db/src/test/java/cn/hutool/db/ConcurentTest.java index f861cbd3e..b5b5450cc 100755 --- a/hutool-db/src/test/java/cn/hutool/db/ConcurentTest.java +++ b/hutool-db/src/test/java/cn/hutool/db/ConcurentTest.java @@ -13,34 +13,34 @@ import java.util.List; /** * SqlRunner线程安全测试 - * + * * @author looly * */ @Ignore public class ConcurentTest { - + private Db db; - + @Before public void init() { db = Db.use("test"); } - + @Test public void findTest() { for(int i = 0; i < 10000; i++) { ThreadUtil.execute(() -> { List find; try { - find = db.find(CollectionUtil.newArrayList("name AS name2"), Entity.create("user"), new EntityListHandler()); + find = db.find(CollectionUtil.newArrayList("name AS name2"), Entity.create("user"), EntityListHandler.create()); } catch (SQLException e) { throw new DbRuntimeException(e); } Console.log(find); }); } - + //主线程关闭会导致连接池销毁,sleep避免此情况引起的问题 ThreadUtil.sleep(5000); } diff --git a/hutool-db/src/test/java/cn/hutool/db/DbTest.java b/hutool-db/src/test/java/cn/hutool/db/DbTest.java index 6b43f5d7c..83350017c 100644 --- a/hutool-db/src/test/java/cn/hutool/db/DbTest.java +++ b/hutool-db/src/test/java/cn/hutool/db/DbTest.java @@ -130,7 +130,7 @@ public class DbTest { ps.setFetchSize(Integer.MIN_VALUE); ps.setFetchDirection(ResultSet.FETCH_FORWARD); return ps; - }), new EntityListHandler()); + }), EntityListHandler.create()); } @Test