diff --git a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle.properties b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle.properties index bcfc808dd6..70657d51ec 100644 --- a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle.properties +++ b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle.properties @@ -13,7 +13,7 @@ meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbProductName. meta.io.cloudbeaver.model.app.ServletSystemInformationCollector.smDbProductVersion.name=Security manager database product version meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Read-only connection -meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Auto-commit +meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommitMode.name = Auto-commit mode meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Keep-alive interval (seconds) meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultSchema.name = Default schema meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultCatalog.name = Default catalog \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_ru.properties b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_ru.properties index 08a1d65e20..f47bcca595 100644 --- a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_ru.properties +++ b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_ru.properties @@ -1,5 +1,5 @@ meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Только для чтения -meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Авто-коммит +meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommitMode.name = Авто-коммит meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Интервал Keep-alive (в секундах) meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultSchema.name = Схема по умолчанию meta.io.cloudbeaver.model.WebExpertSettingsProperties.defaultCatalog.name = Каталог по умолчанию \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_vi.properties b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_vi.properties index f60d3e3372..df0e8e15ac 100644 --- a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_vi.properties +++ b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_vi.properties @@ -1,4 +1,4 @@ meta.io.cloudbeaver.model.WebExpertSettingsProperties.readOnly.name = Kết nối chỉ đọc -meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = Tự động commit +meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommitMode.name = Tự động commit meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = Giữ kết nối (tính bằng giây) meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = Không tự động ngắt kết nối \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_zh.properties b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_zh.properties index 662a0c1b41..35d62aecee 100644 --- a/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_zh.properties +++ b/server/bundles/io.cloudbeaver.model/OSGI-INF/l10n/bundle_zh.properties @@ -1,3 +1,3 @@ -meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommit.name = 自动提交 +meta.io.cloudbeaver.model.WebExpertSettingsProperties.autoCommitMode.name = 自动提交 meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.name = 保持连接 (秒) meta.io.cloudbeaver.model.WebExpertSettingsProperties.keepAliveInterval.description = 无自动断开连接 \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java index e370ec4f27..ed159db4f3 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java @@ -77,9 +77,7 @@ public class WebConnectionConfigInputHandler getExpertSettingsValues() { Map expertSettings = new LinkedHashMap<>(); - expertSettings.put(WebExpertSettingsProperties.PROP_AUTO_COMMIT, isAutocommit()); + expertSettings.put(WebExpertSettingsProperties.PROP_AUTO_COMMIT_MODE, AutoCommitMode.fromValue(isAutocommit())); expertSettings.put(WebExpertSettingsProperties.PROP_KEEP_ALIVE_INTERVAL, getKeepAliveInterval()); expertSettings.put(WebExpertSettingsProperties.PROP_READ_ONLY, isReadOnly()); expertSettings.put(WebExpertSettingsProperties.PROP_DEFAULT_CATALOG, getDefaultCatalogName()); @@ -541,12 +541,9 @@ public class WebConnectionInfo { } @Property - public boolean isAutocommit() { - Boolean isAutoCommit = dataSourceContainer.getConnectionConfiguration().getBootstrap().getDefaultAutoCommit(); - if (isAutoCommit == null) { - return true; - } - return isAutoCommit; + @Nullable + public Boolean isAutocommit() { + return dataSourceContainer.getConnectionConfiguration().getBootstrap().getDefaultAutoCommit(); } @Property diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebExpertSettingsProperties.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebExpertSettingsProperties.java index 86265613d3..1253239801 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebExpertSettingsProperties.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebExpertSettingsProperties.java @@ -1,3 +1,19 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2026 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package io.cloudbeaver.model; import org.jkiss.code.NotNull; @@ -5,6 +21,7 @@ import org.jkiss.code.Nullable; import org.jkiss.dbeaver.model.DBPObject; import org.jkiss.dbeaver.model.connection.DBPDriver; import org.jkiss.dbeaver.model.connection.DBPDriverConstants; +import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider; import org.jkiss.dbeaver.model.meta.IPropertyValueValidator; import org.jkiss.dbeaver.model.meta.Property; import org.jkiss.utils.CommonUtils; @@ -15,6 +32,7 @@ import org.jkiss.utils.CommonUtils; public class WebExpertSettingsProperties implements DBPObject { public static final String PROP_READ_ONLY = "readOnly"; public static final String PROP_AUTO_COMMIT = "autocommit"; + public static final String PROP_AUTO_COMMIT_MODE = "autoCommitMode"; public static final String PROP_KEEP_ALIVE_INTERVAL = "keepAliveInterval"; public static final String PROP_DEFAULT_CATALOG = "defaultCatalogName"; public static final String PROP_DEFAULT_SCHEMA = "defaultSchemaName"; @@ -30,9 +48,15 @@ public class WebExpertSettingsProperties implements DBPObject { return 0; } - @Property(order = 2, id = PROP_AUTO_COMMIT, visibleIf = AutoCommitFieldValidator.class) - public boolean isAutoCommit() { - return true; + @NotNull + @Property( + order = 2, + id = PROP_AUTO_COMMIT_MODE, + visibleIf = AutoCommitFieldValidator.class, + listProvider = AutoCommitListProvider.class + ) + public AutoCommitMode isAutoCommitMode() { + return AutoCommitMode.DEFAULT; } @Property(order = 3, id = PROP_READ_ONLY, visibleIf = ReadOnlyFieldValidator.class) @@ -40,11 +64,13 @@ public class WebExpertSettingsProperties implements DBPObject { return false; } + @Nullable @Property(order = 4, id = PROP_DEFAULT_CATALOG, visibleIf = DefaultCatalogFieldVisibleValidator.class) public String getDefaultCatalog() { return null; } + @Nullable @Property(order = 5, id = PROP_DEFAULT_SCHEMA, visibleIf = DefaultSchemaFieldVisibleValidator.class) public String getDefaultSchema() { return null; @@ -85,4 +111,18 @@ public class WebExpertSettingsProperties implements DBPObject { return CommonUtils.toBoolean(object.driver.getDriverParameter(DBPDriverConstants.PARAM_SUPPORTS_SCHEMA_SELECTION), true); } } + + public static class AutoCommitListProvider implements IPropertyValueListProvider { + + @Override + public boolean allowCustomValue() { + return false; + } + + @Nullable + @Override + public Object[] getPossibleValues(@Nullable WebExpertSettingsProperties object) { + return AutoCommitMode.values(); + } + } } diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebDataSourceUtils.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebDataSourceUtils.java index fb306817ed..c2e3edf421 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebDataSourceUtils.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebDataSourceUtils.java @@ -307,9 +307,7 @@ public class WebDataSourceUtils { if (config.getKeepAliveInterval() >= 0) { dsConfig.setKeepAliveInterval(config.getKeepAliveInterval()); } - if (config.isDefaultAutoCommit() != null) { - dsConfig.getBootstrap().setDefaultAutoCommit(config.isDefaultAutoCommit()); - } + dsConfig.getBootstrap().setDefaultAutoCommit(config.isDefaultAutoCommit()); dsConfig.getBootstrap().setDefaultCatalogName(config.getDefaultCatalogName()); dsConfig.getBootstrap().setDefaultSchemaName(config.getDefaultSchemaName()); // Save provider props