From 573d1460465e20319702ff29c60c3fb920be3eee Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Fri, 24 Sep 2021 11:36:31 +0200 Subject: [PATCH] Removed Dialect#areStringComparisonsCaseInsensitive() method --- .../hibernate/community/dialect/CacheDialect.java | 5 ----- .../community/dialect/TeradataDialect.java | 5 ----- .../main/java/org/hibernate/dialect/Dialect.java | 12 ------------ .../java/org/hibernate/dialect/MySQLDialect.java | 5 ----- .../org/hibernate/dialect/SQLServerDialect.java | 5 ----- .../org/hibernate/dialect/SybaseASEDialect.java | 13 ------------- .../orm/test/querycache/QueryCacheTest.java | 10 +++------- .../java/org/hibernate/testing/DialectChecks.java | 6 ------ .../testing/orm/junit/DialectFeatureChecks.java | 6 ------ 9 files changed, 3 insertions(+), 64 deletions(-) diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java index faeee55c2f..cb9fbd306e 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CacheDialect.java @@ -397,11 +397,6 @@ public class CacheDialect extends Dialect { return false; } - @Override - public boolean areStringComparisonsCaseInsensitive() { - return true; - } - @Override public boolean supportsOrderByInSubquery() { // This is just a guess diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java index 65f36b2eec..8da51895a4 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TeradataDialect.java @@ -341,11 +341,6 @@ public class TeradataDialect extends Dialect { return false; } - @Override - public boolean areStringComparisonsCaseInsensitive() { - return getVersion() < 14; - } - @Override public boolean supportsEmptyInList() { return false; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index 963ace4ad1..0abcd874c5 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -2930,18 +2930,6 @@ public abstract class Dialect implements ConversionContext { return true; } - /** - * Are string comparisons implicitly case insensitive. - *

- * In other words, does [where 'XYZ' = 'xyz'] resolve to true? - * - * @return True if comparisons are case insensitive. - * @since 3.2 - */ - public boolean areStringComparisonsCaseInsensitive() { - return false; - } - /** * Is this dialect known to support what ANSI-SQL terms "row value * constructor" syntax; sometimes called tuple syntax. diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java index 96ed44c0f8..f03f3beb2b 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java @@ -787,11 +787,6 @@ public class MySQLDialect extends Dialect { return false; } - @Override - public boolean areStringComparisonsCaseInsensitive() { - return true; - } - @Override public boolean supportsLobValueChangePropagation() { // note: at least my local MySQL 5.1 install shows this not working... diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java index d23cf2a42b..66051327ef 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java @@ -387,11 +387,6 @@ public class SQLServerDialect extends AbstractTransactSQLDialect { // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - @Override - public boolean areStringComparisonsCaseInsensitive() { - return true; - } - @Override public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() { return false; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java index 791bcdbc25..33ea682a2d 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java @@ -482,19 +482,6 @@ public class SybaseASEDialect extends SybaseDialect { return 30; } - /** - * By default, Sybase string comparisons are case-insensitive. - *

- * If the DB is configured to be case-sensitive, then this return - * value will be incorrect. - *

- * {@inheritDoc} - */ - @Override - public boolean areStringComparisonsCaseInsensitive() { - return true; - } - @Override @SuppressWarnings("deprecation") public String getCurrentTimestampSQLFunctionName() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/querycache/QueryCacheTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/querycache/QueryCacheTest.java index e9d865734c..69966df4a3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/querycache/QueryCacheTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/querycache/QueryCacheTest.java @@ -371,15 +371,11 @@ public class QueryCacheTest { } @Test - @RequiresDialectFeature( - feature = DialectFeatureChecks.CaseSensitiveCheck.class, - comment = "i.name='widget' should not match on case sensitive database." - ) - public void testCaseInsensitiveComparison(SessionFactoryScope scope) { + public void testComparison(SessionFactoryScope scope) { Item item = new Item(); scope.inTransaction( session -> { - item.setName( "Widget" ); + item.setName( "widget" ); item.setDescription( "A really top-quality, full-featured widget." ); session.save( item ); } @@ -390,7 +386,7 @@ public class QueryCacheTest { List result = session.createQuery( queryString ).list(); assertEquals( 1, result.size() ); Item i = session.get( Item.class, item.getId() ); - assertEquals( "Widget", i.getName() ); + assertEquals( "widget", i.getName() ); session.delete( i ); } ); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java index a865aa1d76..2a6b70486c 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java @@ -63,12 +63,6 @@ abstract public class DialectChecks { } } - public static class CaseSensitiveCheck implements DialectCheck { - public boolean isMatch(Dialect dialect) { - return dialect.areStringComparisonsCaseInsensitive(); - } - } - public static class SupportsResultSetPositioningOnForwardOnlyCursorCheck implements DialectCheck { public boolean isMatch(Dialect dialect) { return dialect.supportsResultSetPositionQueryMethodsOnForwardOnlyCursor(); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java index eb3af0d945..1c262b9073 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java @@ -80,12 +80,6 @@ abstract public class DialectFeatureChecks { } } - public static class CaseSensitiveCheck implements DialectFeatureCheck { - public boolean apply(Dialect dialect) { - return dialect.areStringComparisonsCaseInsensitive(); - } - } - public static class SupportsNoColumnInsert implements DialectFeatureCheck { public boolean apply(Dialect dialect) { return dialect.supportsNoColumnsInsert();