Skip to content

Commit

Permalink
Merge pull request #3276 from ebean-orm/feature/skipCheckForReadOnly
Browse files Browse the repository at this point in the history
skipDataSourceCheck() when using readOnlyDatabase
rbygrave authored Nov 23, 2023
2 parents 87ad874 + 97709d3 commit eaec515
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1336,7 +1336,7 @@ public DatabaseConfig setAutoTuneConfig(AutoTuneConfig autoTuneConfig) {

@Override
public boolean skipDataSourceCheck() {
return skipDataSourceCheck;
return skipDataSourceCheck || readOnlyDatabase;
}

@Override
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.ebeaninternal.server.core;

import io.ebean.Database;
import io.ebean.DatabaseBuilder;
import io.ebean.config.*;
import io.ebean.config.dbplatform.DatabasePlatform;
@@ -64,10 +65,8 @@ public void shutdown() {
*/
@Override
public SpiEbeanServer createServer(String name) {
DatabaseBuilder config = new DatabaseConfig();
config.setName(name);
config.loadFromProperties();
return createServer(config);
var builder = Database.builder().name(name).loadFromProperties();
return createServer(builder);
}

private SpiBackgroundExecutor createBackgroundExecutor(DatabaseBuilder builder) {
@@ -94,7 +93,7 @@ public SpiEbeanServer createServer(DatabaseBuilder builder) {

boolean online = true;
if (config.isDocStoreOnly()) {
config.setDatabasePlatform(new DatabasePlatform());
config.databasePlatform(new DatabasePlatform());
} else {
TenantMode tenantMode = config.getTenantMode();
if (TenantMode.DB != tenantMode) {
@@ -203,7 +202,7 @@ private BootupClasses bootupClasses1(DatabaseBuilder.Settings config) {
*/
private void setNamingConvention(DatabaseBuilder.Settings config) {
if (config.getNamingConvention() == null) {
config.setNamingConvention(new UnderscoreNamingConvention());
config.namingConvention(new UnderscoreNamingConvention());
}
}

@@ -218,7 +217,7 @@ private void setDatabasePlatform(DatabaseBuilder.Settings config) {
}
// automatically determine the platform
platform = new DatabasePlatformFactory().create(config);
config.setDatabasePlatform(platform);
config.databasePlatform(platform);
}
platform.configure(config.getPlatformConfig());
}
@@ -242,11 +241,9 @@ private boolean isOfflineMode(DatabaseBuilder.Settings config) {
* Check the autoCommit and Transaction Isolation levels of the DataSource.
* <p>
* If autoCommit is true this could be a real problem.
* </p>
* <p>
* If the Isolation level is not READ_COMMITTED then optimistic concurrency
* checking may not work as expected.
* </p>
*/
private boolean checkDataSource(DatabaseBuilder.Settings config) {
if (isOfflineMode(config)) {

0 comments on commit eaec515

Please sign in to comment.