Skip to content

Commit

Permalink
Merge pull request #3238 from harawata/3234-deprecate-unused-setting
Browse files Browse the repository at this point in the history
Deprecate unused setting `multipleResultSetsEnabled`
  • Loading branch information
harawata committed Sep 7, 2024
2 parents 5ded7bc + bc77b9d commit b4ae220
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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")));
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/org/apache/ibatis/session/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> getLazyLoadTriggerMethods() {
Expand Down
6 changes: 2 additions & 4 deletions src/site/es/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,9 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
</tr>
<tr>
<td>
multipleResultSetsEnabled
</td>
<td>Habilita o inhabilita la obtención de múltiples ResultSets con una sola sentencia (se requiere un driver compatible)
<strike>multipleResultSetsEnabled</strike>
</td>
<td>Deprecated. This option has no effect.</td>
<td>
true | false
</td>
Expand Down Expand Up @@ -615,7 +614,6 @@ A continuación se muestra un ejemplo del elemento settings al completo:
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="autoMappingBehavior" value="PARTIAL"/>
Expand Down
5 changes: 2 additions & 3 deletions src/site/ja/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
</tr>
<tr>
<td>
multipleResultSetsEnabled
<strike>multipleResultSetsEnabled</strike>
</td>
<td>
1つのステートメントから複数の ResultSet を返すことを許可するかどうかを指定します(複数 ResultSet に対応したドライバが必要です)
非推奨。この設定は何の効果もありません
</td>
<td>
true | false
Expand Down Expand Up @@ -639,7 +639,6 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="autoMappingBehavior" value="PARTIAL"/>
Expand Down
5 changes: 2 additions & 3 deletions src/site/ko/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
</tr>
<tr>
<td>
multipleResultSetsEnabled
<strike>multipleResultSetsEnabled</strike>
</td>
<td>한 개의 구문에서 여러 개의 ResultSet을 허용할지의 여부(드라이버가 해당 기능을 지원해야 함) </td>
<td>Deprecated. This option has no effect.</td>
<td>
true | false
</td>
Expand Down Expand Up @@ -620,7 +620,6 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="autoMappingBehavior" value="PARTIAL"/>
Expand Down
3 changes: 1 addition & 2 deletions src/site/markdown/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 &#124; 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 &#124; 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 &#124; false | false (true in ≤3.4.1) |
| multipleResultSetsEnabled | Allows or disallows multiple ResultSets to be returned from a single statement (compatible driver required). | true &#124; false | true |
| ~~multipleResultSetsEnabled~~ | Deprecated. This option has no effect. | true &#124; 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 &#124; 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 &#124; 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 |
Expand Down Expand Up @@ -145,7 +145,6 @@ An example of the settings element fully configured is as follows:
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="autoMappingBehavior" value="PARTIAL"/>
Expand Down
5 changes: 2 additions & 3 deletions src/site/zh_CN/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
</tr>
<tr>
<td>
multipleResultSetsEnabled
<strike>multipleResultSetsEnabled</strike>
</td>
<td>
是否允许单个语句返回多结果集(需要数据库驱动支持)。
Deprecated. This option has no effect.
</td>
<td>
true | false
Expand Down Expand Up @@ -632,7 +632,6 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="autoMappingBehavior" value="PARTIAL"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2009-2022 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.
Expand Down Expand Up @@ -34,7 +34,6 @@
<setting name="proxyFactory" value="CGLIB"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="false"/>
<setting name="useColumnLabel" value="false"/>
<setting name="useGeneratedKeys" value="true"/>
<setting name="defaultExecutorType" value="BATCH"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2009-2022 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.
Expand All @@ -27,7 +27,6 @@
<settings>
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="false"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="defaultExecutorType" value="SIMPLE"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2009-2022 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.
Expand Down Expand Up @@ -32,7 +32,6 @@
<setting name="proxyFactory" value="CGLIB"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="aggressiveLazyLoading" value="true"/>
<setting name="multipleResultSetsEnabled" value="false"/>
<setting name="useColumnLabel" value="false"/>
<setting name="useGeneratedKeys" value="true"/>
<setting name="defaultExecutorType" value="BATCH"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2009-2022 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.
Expand All @@ -24,7 +24,6 @@
<settings>
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="false"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="defaultExecutorType" value="SIMPLE"/>
<setting name="defaultStatementTimeout" value="25"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2009-2022 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.
Expand All @@ -24,7 +24,6 @@
<settings>
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="false"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="defaultExecutorType" value="SIMPLE"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2009-2022 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.
Expand All @@ -25,7 +25,6 @@
<settings>
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="mapUnderscoreToCamelCase" value="true" />
</settings>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2009-2022 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.
Expand Down Expand Up @@ -29,7 +29,6 @@
<settings>
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="false"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="defaultExecutorType" value="SIMPLE"/>
Expand Down
Loading

0 comments on commit b4ae220

Please sign in to comment.