Skip to content

Commit

Permalink
mybatis#782 multipleResultSetsEnabled has been deprecated in core 3.5.17
Browse files Browse the repository at this point in the history
  • Loading branch information
harawata committed Dec 15, 2024
1 parent 88a55b5 commit 569fdcc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/mybatis/guice/MyBatisModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ protected final void aggressiveLazyLoading(boolean aggressiveLazyLoading) {
/**
* Multiple result sets enabled.
*
* @deprecated this option has no effect
*
* @param multipleResultSetsEnabled
* the multiple result sets enabled
*/
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 All @@ -17,6 +17,8 @@

import com.google.inject.ProvisionException;

import edu.umd.cs.findbugs.annotations.Nullable;

import jakarta.inject.Named;
import jakarta.inject.Provider;
import jakarta.inject.Singleton;
Expand All @@ -35,8 +37,6 @@
import org.mybatis.guice.configuration.settings.ConfigurationSetting;
import org.mybatis.guice.configuration.settings.MapperConfigurationSetting;

import edu.umd.cs.findbugs.annotations.Nullable;

/**
* Provides the myBatis Configuration.
*/
Expand All @@ -56,6 +56,7 @@ public class ConfigurationProvider implements Provider<Configuration>, Configura
@Named("mybatis.configuration.aggressiveLazyLoading")
private boolean aggressiveLazyLoading = true;

@Deprecated
@com.google.inject.Inject(optional = true)
@Named("mybatis.configuration.multipleResultSetsEnabled")
private boolean multipleResultSetsEnabled = true;
Expand Down Expand Up @@ -163,7 +164,6 @@ public Configuration get() {
final Configuration configuration = newConfiguration(environment);
configuration.setLazyLoadingEnabled(lazyLoadingEnabled);
configuration.setAggressiveLazyLoading(aggressiveLazyLoading);
configuration.setMultipleResultSetsEnabled(multipleResultSetsEnabled);
configuration.setUseGeneratedKeys(useGeneratedKeys);
configuration.setUseColumnLabel(useColumnLabel);
configuration.setCacheEnabled(cacheEnabled);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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 @@ -17,6 +17,9 @@

import org.apache.ibatis.session.Configuration;

/**
* @deprecated This option has no effect.
*/
public class MultipleResultSetsEnabledConfigurationSetting implements ConfigurationSetting {

private final boolean multipleResultSetsEnabled;
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/org/mybatis/guice/MyBatisModuleTest.java
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 @@ -63,6 +63,7 @@
import org.apache.ibatis.type.TypeHandler;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
Expand Down Expand Up @@ -272,6 +273,7 @@ protected void initialize() {
assertEquals(true, configuration.isMultipleResultSetsEnabled());
}

@Disabled("multipleResultSetsEnabled is deprecated")
@Test
void multipleResultSetsEnabled_False() {
Injector injector = Guice.createInjector(new MyBatisModule() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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 @@ -104,7 +104,6 @@ protected void configure() {
assertEquals(0, configuration.getInterceptors().size());
assertFalse(configuration.isLazyLoadingEnabled());
assertTrue(configuration.isAggressiveLazyLoading());
assertTrue(configuration.isMultipleResultSetsEnabled());
assertFalse(configuration.isUseGeneratedKeys());
assertTrue(configuration.isUseColumnLabel());
assertTrue(configuration.isCacheEnabled());
Expand All @@ -130,7 +129,6 @@ protected void configure() {
bind(DataSource.class).toInstance(dataSource);
bindConstant().annotatedWith(Names.named("mybatis.configuration.lazyLoadingEnabled")).to(true);
bindConstant().annotatedWith(Names.named("mybatis.configuration.aggressiveLazyLoading")).to(false);
bindConstant().annotatedWith(Names.named("mybatis.configuration.multipleResultSetsEnabled")).to(false);
bindConstant().annotatedWith(Names.named("mybatis.configuration.useGeneratedKeys")).to(true);
bindConstant().annotatedWith(Names.named("mybatis.configuration.useColumnLabel")).to(false);
bindConstant().annotatedWith(Names.named("mybatis.configuration.cacheEnabled")).to(false);
Expand Down Expand Up @@ -183,7 +181,6 @@ public void applyConfigurationSetting(Configuration configuration) {
assertEquals(databaseId, configuration.getDatabaseId());
assertTrue(configuration.isLazyLoadingEnabled());
assertFalse(configuration.isAggressiveLazyLoading());
assertFalse(configuration.isMultipleResultSetsEnabled());
assertTrue(configuration.isUseGeneratedKeys());
assertFalse(configuration.isUseColumnLabel());
assertFalse(configuration.isCacheEnabled());
Expand Down

0 comments on commit 569fdcc

Please sign in to comment.