From bc77b9d49fd7156b3ff96a1663d7ba85ecc9ec46 Mon Sep 17 00:00:00 2001 From: Iwao AVE! Date: Mon, 2 Sep 2024 05:36:23 +0900 Subject: [PATCH] Deprecate unused setting `multipleResultSetsEnabled` The option is not used at all, it seems. Should fix #3234 --- .../apache/ibatis/builder/xml/XMLConfigBuilder.java | 3 +-- .../org/apache/ibatis/session/Configuration.java | 13 ++++++++++--- src/site/es/xdoc/configuration.xml | 6 ++---- src/site/ja/xdoc/configuration.xml | 5 ++--- src/site/ko/xdoc/configuration.xml | 5 ++--- src/site/markdown/configuration.md | 3 +-- src/site/zh_CN/xdoc/configuration.xml | 5 ++--- .../apache/ibatis/builder/XmlConfigBuilderTest.java | 4 +--- .../ibatis/builder/xsd/XmlConfigBuilderTest.java | 4 +--- .../apache/ibatis/executor/BaseExecutorTest.java | 3 +-- .../builder/CustomizedSettingsMapperConfig.xml | 3 +-- .../org/apache/ibatis/builder/MapperConfig.xml | 3 +-- .../builder/xsd/CustomizedSettingsMapperConfig.xml | 3 +-- .../ibatis/submitted/awful_table/MapperConfig.xml | 3 +-- .../ibatis/submitted/blobtest/MapperConfig.xml | 3 +-- .../mybatis-config.xml | 3 +-- .../submitted/nested_query_cache/MapperConfig.xml | 3 +-- .../ibatis/submitted/null_associations/sqlmap.xml | 3 +-- .../submitted/overwritingproperties/sqlmap.xml | 3 +-- .../ibatis/submitted/sptests/MapperConfig.xml | 3 +-- 20 files changed, 33 insertions(+), 48 deletions(-) diff --git a/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java b/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java index 255b94b5f2d..7d53e55ac42 100644 --- a/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java +++ b/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2023 the original author or authors. + * Copyright 2009-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -267,7 +267,6 @@ private void settingsElement(Properties props) { configuration.setProxyFactory((ProxyFactory) createInstance(props.getProperty("proxyFactory"))); configuration.setLazyLoadingEnabled(booleanValueOf(props.getProperty("lazyLoadingEnabled"), false)); configuration.setAggressiveLazyLoading(booleanValueOf(props.getProperty("aggressiveLazyLoading"), false)); - configuration.setMultipleResultSetsEnabled(booleanValueOf(props.getProperty("multipleResultSetsEnabled"), true)); configuration.setUseColumnLabel(booleanValueOf(props.getProperty("useColumnLabel"), true)); configuration.setUseGeneratedKeys(booleanValueOf(props.getProperty("useGeneratedKeys"), false)); configuration.setDefaultExecutorType(ExecutorType.valueOf(props.getProperty("defaultExecutorType", "SIMPLE"))); diff --git a/src/main/java/org/apache/ibatis/session/Configuration.java b/src/main/java/org/apache/ibatis/session/Configuration.java index 72b50d3808f..dfc8dd0218c 100644 --- a/src/main/java/org/apache/ibatis/session/Configuration.java +++ b/src/main/java/org/apache/ibatis/session/Configuration.java @@ -108,7 +108,6 @@ public class Configuration { protected boolean safeResultHandlerEnabled = true; protected boolean mapUnderscoreToCamelCase; protected boolean aggressiveLazyLoading; - protected boolean multipleResultSetsEnabled = true; protected boolean useGeneratedKeys; protected boolean useColumnLabel = true; protected boolean cacheEnabled = true; @@ -456,12 +455,20 @@ public void setAggressiveLazyLoading(boolean aggressiveLazyLoading) { this.aggressiveLazyLoading = aggressiveLazyLoading; } + /** + * @deprecated You can safely remove the call to this method as this option had no effect. + */ + @Deprecated public boolean isMultipleResultSetsEnabled() { - return multipleResultSetsEnabled; + return true; } + /** + * @deprecated You can safely remove the call to this method as this option had no effect. + */ + @Deprecated public void setMultipleResultSetsEnabled(boolean multipleResultSetsEnabled) { - this.multipleResultSetsEnabled = multipleResultSetsEnabled; + // nop } public Set getLazyLoadTriggerMethods() { diff --git a/src/site/es/xdoc/configuration.xml b/src/site/es/xdoc/configuration.xml index 7ab91407c6e..9307eb1b5c3 100644 --- a/src/site/es/xdoc/configuration.xml +++ b/src/site/es/xdoc/configuration.xml @@ -187,10 +187,9 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ - multipleResultSetsEnabled - - Habilita o inhabilita la obtención de múltiples ResultSets con una sola sentencia (se requiere un driver compatible) + multipleResultSetsEnabled + Deprecated. This option has no effect. true | false @@ -615,7 +614,6 @@ A continuación se muestra un ejemplo del elemento settings al completo: - diff --git a/src/site/ja/xdoc/configuration.xml b/src/site/ja/xdoc/configuration.xml index fbbec10a49d..1184e818ae5 100644 --- a/src/site/ja/xdoc/configuration.xml +++ b/src/site/ja/xdoc/configuration.xml @@ -200,10 +200,10 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ - multipleResultSetsEnabled + multipleResultSetsEnabled - 1つのステートメントから複数の ResultSet を返すことを許可するかどうかを指定します(複数 ResultSet に対応したドライバが必要です)。 + 非推奨。この設定は何の効果もありません。 true | false @@ -639,7 +639,6 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ - diff --git a/src/site/ko/xdoc/configuration.xml b/src/site/ko/xdoc/configuration.xml index 2f6d8b5c0f3..9baea9b1b0f 100644 --- a/src/site/ko/xdoc/configuration.xml +++ b/src/site/ko/xdoc/configuration.xml @@ -179,9 +179,9 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ - multipleResultSetsEnabled + multipleResultSetsEnabled - 한 개의 구문에서 여러 개의 ResultSet을 허용할지의 여부(드라이버가 해당 기능을 지원해야 함) + Deprecated. This option has no effect. true | false @@ -620,7 +620,6 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ - diff --git a/src/site/markdown/configuration.md b/src/site/markdown/configuration.md index acc347bc6e9..63fb4e65b7d 100644 --- a/src/site/markdown/configuration.md +++ b/src/site/markdown/configuration.md @@ -108,7 +108,7 @@ These are extremely important tweaks that modify the way that MyBatis behaves at | cacheEnabled | Globally enables or disables any caches configured in any mapper under this configuration. | true | false | true | | lazyLoadingEnabled | Globally enables or disables lazy loading. When enabled, all relations will be lazily loaded. This value can be superseded for a specific relation by using the `fetchType` attribute on it. | true | false | false | | aggressiveLazyLoading | When enabled, any method call will load all the lazy properties of the object. Otherwise, each property is loaded on demand (see also `lazyLoadTriggerMethods`). | true | false | false (true in ≤3.4.1) | -| multipleResultSetsEnabled | Allows or disallows multiple ResultSets to be returned from a single statement (compatible driver required). | true | false | true | +| ~~multipleResultSetsEnabled~~ | Deprecated. This option has no effect. | true | false | true | | useColumnLabel | Uses the column label instead of the column name. Different drivers behave differently in this respect. Refer to the driver documentation, or test out both modes to determine how your driver behaves. | true | false | true | | useGeneratedKeys | Allows JDBC support for generated keys. A compatible driver is required. This setting forces generated keys to be used if set to true, as some drivers deny compatibility but still work (e.g. Derby). | true | false | False | | autoMappingBehavior | Specifies if and how MyBatis should automatically map columns to fields/properties. NONE disables auto-mapping. PARTIAL will only auto-map results with no nested result mappings defined inside. FULL will auto-map result mappings of any complexity (containing nested or otherwise). | NONE, PARTIAL, FULL | PARTIAL | @@ -145,7 +145,6 @@ An example of the settings element fully configured is as follows: - diff --git a/src/site/zh_CN/xdoc/configuration.xml b/src/site/zh_CN/xdoc/configuration.xml index e07b3e9a60a..81421a2edf1 100644 --- a/src/site/zh_CN/xdoc/configuration.xml +++ b/src/site/zh_CN/xdoc/configuration.xml @@ -193,10 +193,10 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ - multipleResultSetsEnabled + multipleResultSetsEnabled - 是否允许单个语句返回多结果集(需要数据库驱动支持)。 + Deprecated. This option has no effect. true | false @@ -632,7 +632,6 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ - diff --git a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java index bf8692883d2..64c74112d0c 100644 --- a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java +++ b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2023 the original author or authors. + * Copyright 2009-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,6 @@ void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception { assertThat(config.getProxyFactory()).isInstanceOf(JavassistProxyFactory.class); assertThat(config.isLazyLoadingEnabled()).isFalse(); assertThat(config.isAggressiveLazyLoading()).isFalse(); - assertThat(config.isMultipleResultSetsEnabled()).isTrue(); assertThat(config.isUseColumnLabel()).isTrue(); assertThat(config.isUseGeneratedKeys()).isFalse(); assertThat(config.getDefaultExecutorType()).isEqualTo(ExecutorType.SIMPLE); @@ -193,7 +192,6 @@ void shouldSuccessfullyLoadXMLConfigFile() throws Exception { assertThat(config.getProxyFactory()).isInstanceOf(CglibProxyFactory.class); assertThat(config.isLazyLoadingEnabled()).isTrue(); assertThat(config.isAggressiveLazyLoading()).isTrue(); - assertThat(config.isMultipleResultSetsEnabled()).isFalse(); assertThat(config.isUseColumnLabel()).isFalse(); assertThat(config.isUseGeneratedKeys()).isTrue(); assertThat(config.getDefaultExecutorType()).isEqualTo(ExecutorType.BATCH); diff --git a/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java b/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java index e60cb10d256..00455036d3c 100644 --- a/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java +++ b/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2023 the original author or authors. + * Copyright 2009-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +75,6 @@ void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception { assertTrue(config.getProxyFactory() instanceof JavassistProxyFactory); assertFalse(config.isLazyLoadingEnabled()); assertFalse(config.isAggressiveLazyLoading()); - assertTrue(config.isMultipleResultSetsEnabled()); assertTrue(config.isUseColumnLabel()); assertFalse(config.isUseGeneratedKeys()); assertEquals(ExecutorType.SIMPLE, config.getDefaultExecutorType()); @@ -114,7 +113,6 @@ void shouldSuccessfullyLoadXMLConfigFile() throws Exception { assertTrue(config.getProxyFactory() instanceof CglibProxyFactory); assertTrue(config.isLazyLoadingEnabled()); assertTrue(config.isAggressiveLazyLoading()); - assertFalse(config.isMultipleResultSetsEnabled()); assertFalse(config.isUseColumnLabel()); assertTrue(config.isUseGeneratedKeys()); assertEquals(ExecutorType.BATCH, config.getDefaultExecutorType()); diff --git a/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java b/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java index 4fe66ccaf7c..40e9f629e71 100644 --- a/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java +++ b/src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2023 the original author or authors. + * Copyright 2009-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,6 @@ static void setup() throws Exception { config = new Configuration(); config.setLazyLoadingEnabled(true); config.setUseGeneratedKeys(false); - config.setMultipleResultSetsEnabled(true); config.setUseColumnLabel(true); config.setDefaultStatementTimeout(5000); config.setDefaultFetchSize(100); diff --git a/src/test/resources/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml b/src/test/resources/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml index 9d6be287d99..5554be7d27b 100644 --- a/src/test/resources/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml +++ b/src/test/resources/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml @@ -1,7 +1,7 @@