- * If not set a default implementation will be used.
- */
- JsonFactory getJsonFactory();
-
/**
* Set the Jackson JsonFactory to use.
*
@@ -134,31 +95,16 @@ public interface DatabaseBuilder {
*/
void setJsonFactory(JsonFactory jsonFactory);
- /**
- * Return the JSON format used for DateTime types.
- */
- JsonConfig.DateTime getJsonDateTime();
-
/**
* Set the JSON format to use for DateTime types.
*/
void setJsonDateTime(JsonConfig.DateTime jsonDateTime);
- /**
- * Return the JSON format used for Date types.
- */
- JsonConfig.Date getJsonDate();
-
/**
* Set the JSON format to use for Date types.
*/
void setJsonDate(JsonConfig.Date jsonDate);
- /**
- * Return the JSON include mode used when writing JSON.
- */
- JsonConfig.Include getJsonInclude();
-
/**
* Set the JSON include mode used when writing JSON.
*
@@ -166,13 +112,6 @@ public interface DatabaseBuilder {
*/
void setJsonInclude(JsonConfig.Include jsonInclude);
- /**
- * Return the default MutableDetection to use with {@code @DbJson} using Jackson.
- *
- * @see DbJson#mutationDetection()
- */
- MutationDetection getJsonMutationDetection();
-
/**
* Set the default MutableDetection to use with {@code @DbJson} using Jackson.
*
@@ -180,23 +119,11 @@ public interface DatabaseBuilder {
*/
void setJsonMutationDetection(MutationDetection jsonMutationDetection);
- /**
- * Return the name of the Database.
- */
- String getName();
-
/**
* Set the name of the Database.
*/
void setName(String name);
- /**
- * Return the container / clustering configuration.
- *
- * By default this is set to true.
- */
- boolean isRegister();
-
/**
* Set to false if you do not want this server to be registered with the Ebean
* singleton when it is created.
@@ -222,14 +141,6 @@ public interface DatabaseBuilder {
*/
void setRegister(boolean register);
- /**
- * Return true if this server should be registered as the "default" server
- * with the Ebean singleton.
- *
- * This is only used when {@link #setRegister(boolean)} is also true.
- */
- boolean isDefaultServer();
-
/**
* Set false if you do not want this Database to be registered as the "default" database
* with the DB singleton.
@@ -238,63 +149,32 @@ public interface DatabaseBuilder {
*/
void setDefaultServer(boolean defaultServer);
- /**
- * Return the CurrentUserProvider. This is used to populate @WhoCreated, @WhoModified and
- * support other audit features (who executed a query etc).
- */
- CurrentUserProvider getCurrentUserProvider();
-
/**
* Set the CurrentUserProvider. This is used to populate @WhoCreated, @WhoModified and
* support other audit features (who executed a query etc).
*/
void setCurrentUserProvider(CurrentUserProvider currentUserProvider);
- /**
- * Return the tenancy mode used.
- */
- TenantMode getTenantMode();
-
/**
* Set the tenancy mode to use.
*/
void setTenantMode(TenantMode tenantMode);
- /**
- * Return the column name used for TenantMode.PARTITION.
- */
- String getTenantPartitionColumn();
-
/**
* Set the column name used for TenantMode.PARTITION.
*/
void setTenantPartitionColumn(String tenantPartitionColumn);
- /**
- * Return the current tenant provider.
- */
- CurrentTenantProvider getCurrentTenantProvider();
-
/**
* Set the current tenant provider.
*/
void setCurrentTenantProvider(CurrentTenantProvider currentTenantProvider);
- /**
- * Return the tenancy datasource provider.
- */
- TenantDataSourceProvider getTenantDataSourceProvider();
-
/**
* Set the tenancy datasource provider.
*/
void setTenantDataSourceProvider(TenantDataSourceProvider tenantDataSourceProvider);
- /**
- * Return the tenancy schema provider.
- */
- TenantSchemaProvider getTenantSchemaProvider();
-
/**
* Set the tenancy schema provider.
*/
@@ -320,15 +200,6 @@ public interface DatabaseBuilder {
*/
void setAutoPersistUpdates(boolean autoPersistUpdates);
- /**
- * Return the PersistBatch mode to use by default at the transaction level.
- *
- * When INSERT or ALL is used then save(), delete() etc do not execute immediately but instead go into
- * a JDBC batch execute buffer that is flushed. The buffer is flushed if a query is executed, transaction ends
- * or the batch size is meet.
- */
- PersistBatch getPersistBatch();
-
/**
* Set the JDBC batch mode to use at the transaction level.
*
@@ -338,16 +209,6 @@ public interface DatabaseBuilder {
*/
void setPersistBatch(PersistBatch persistBatch);
- /**
- * Return the JDBC batch mode to use per save(), delete(), insert() or update() request.
- *
- * This makes sense when a save() or delete() cascades and executes multiple child statements. The best case
- * for this is when saving a master/parent bean this cascade inserts many detail/child beans.
- *
- * This only takes effect when the persistBatch mode at the transaction level does not take effect.
- */
- PersistBatch getPersistBatchOnCascade();
-
/**
* Set the JDBC batch mode to use per save(), delete(), insert() or update() request.
*
@@ -371,11 +232,6 @@ public interface DatabaseBuilder {
*/
void setPersistBatching(boolean persistBatching);
- /**
- * Return the batch size used for JDBC batching. This defaults to 20.
- */
- int getPersistBatchSize();
-
/**
* Set the batch size used for JDBC batching. If unset this defaults to 20.
*
@@ -385,13 +241,6 @@ public interface DatabaseBuilder {
*/
void setPersistBatchSize(int persistBatchSize);
- /**
- * Gets the query batch size. This defaults to 100.
- *
- * @return the query batch size
- */
- int getQueryBatchSize();
-
/**
* Sets the query batch size. This defaults to 100.
*
@@ -399,15 +248,8 @@ public interface DatabaseBuilder {
*/
void setQueryBatchSize(int queryBatchSize);
- EnumType getDefaultEnumType();
-
void setDefaultEnumType(EnumType defaultEnumType);
- /**
- * Return true if lazy loading is disabled on queries by default.
- */
- boolean isDisableLazyLoading();
-
/**
* Set to true to disable lazy loading by default.
*
@@ -415,11 +257,6 @@ public interface DatabaseBuilder {
*/
void setDisableLazyLoading(boolean disableLazyLoading);
- /**
- * Return the default batch size for lazy loading of beans and collections.
- */
- int getLazyLoadBatchSize();
-
/**
* Set the default batch size for lazy loading.
*
@@ -442,34 +279,16 @@ public interface DatabaseBuilder {
*/
void setDatabaseSequenceBatchSize(int databaseSequenceBatchSize);
- /**
- * Return the default JDBC fetchSize hint for findList queries.
- */
- int getJdbcFetchSizeFindList();
-
/**
* Set the default JDBC fetchSize hint for findList queries.
*/
void setJdbcFetchSizeFindList(int jdbcFetchSizeFindList);
- /**
- * Return the default JDBC fetchSize hint for findEach/findEachWhile queries.
- */
- int getJdbcFetchSizeFindEach();
-
/**
* Set the default JDBC fetchSize hint for findEach/findEachWhile queries.
*/
void setJdbcFetchSizeFindEach(int jdbcFetchSizeFindEach);
- /**
- * Return the ChangeLogPrepare.
- *
- * This is used to set user context information to the ChangeSet in the
- * foreground thread prior to the logging occurring in a background thread.
- */
- ChangeLogPrepare getChangeLogPrepare();
-
/**
* Set the ChangeLogPrepare.
*
@@ -478,25 +297,12 @@ public interface DatabaseBuilder {
*/
void setChangeLogPrepare(ChangeLogPrepare changeLogPrepare);
- /**
- * Return the ChangeLogListener which actually performs the logging of change sets
- * in the background.
- */
- ChangeLogListener getChangeLogListener();
-
/**
* Set the ChangeLogListener which actually performs the logging of change sets
* in the background.
*/
void setChangeLogListener(ChangeLogListener changeLogListener);
- /**
- * Return the ChangeLogRegister which controls which ChangeLogFilter is used for each
- * bean type and in this way provide fine grained control over which persist requests
- * are included in the change log.
- */
- ChangeLogRegister getChangeLogRegister();
-
/**
* Set the ChangeLogRegister which controls which ChangeLogFilter is used for each
* bean type and in this way provide fine grained control over which persist requests
@@ -504,31 +310,16 @@ public interface DatabaseBuilder {
*/
void setChangeLogRegister(ChangeLogRegister changeLogRegister);
- /**
- * Return true if inserts should be included in the change log by default.
- */
- boolean isChangeLogIncludeInserts();
-
/**
* Set if inserts should be included in the change log by default.
*/
void setChangeLogIncludeInserts(boolean changeLogIncludeInserts);
- /**
- * Return true (default) if the changelog should be written async.
- */
- boolean isChangeLogAsync();
-
/**
* Sets if the changelog should be written async (default = true).
*/
void setChangeLogAsync(boolean changeLogAsync);
- /**
- * Return the ReadAuditLogger to use.
- */
- ReadAuditLogger getReadAuditLogger();
-
/**
* Set the ReadAuditLogger to use. If not set the default implementation is used
* which logs the read events in JSON format to a standard named SLF4J logger
@@ -536,11 +327,6 @@ public interface DatabaseBuilder {
*/
void setReadAuditLogger(ReadAuditLogger readAuditLogger);
- /**
- * Return the ReadAuditPrepare to use.
- */
- ReadAuditPrepare getReadAuditPrepare();
-
/**
* Set the ReadAuditPrepare to use.
*
@@ -550,21 +336,11 @@ public interface DatabaseBuilder {
*/
void setReadAuditPrepare(ReadAuditPrepare readAuditPrepare);
- /**
- * Return the configuration for profiling.
- */
- ProfilingConfig getProfilingConfig();
-
/**
* Set the configuration for profiling.
*/
void setProfilingConfig(ProfilingConfig profilingConfig);
- /**
- * Return the DB schema to use.
- */
- String getDbSchema();
-
/**
* Set the DB schema to use. This specifies to use this schema for:
*
@@ -575,223 +351,110 @@ public interface DatabaseBuilder {
*/
void setDbSchema(String dbSchema);
- /**
- * Return the Geometry SRID.
- */
- int getGeometrySRID();
-
/**
* Set the Geometry SRID.
*/
void setGeometrySRID(int geometrySRID);
- /**
- * Return the time zone to use when reading/writing Timestamps via JDBC.
- *
- * When set a Calendar object is used in JDBC calls when reading/writing Timestamp objects.
- */
- String getDataTimeZone();
-
/**
* Set the time zone to use when reading/writing Timestamps via JDBC.
*/
void setDataTimeZone(String dataTimeZone);
- /**
- * Return the suffix appended to the base table to derive the view that contains the union
- * of the base table and the history table in order to support asOf queries.
- */
- String getAsOfViewSuffix();
-
/**
* Set the suffix appended to the base table to derive the view that contains the union
* of the base table and the history table in order to support asOf queries.
*/
void setAsOfViewSuffix(String asOfViewSuffix);
- /**
- * Return the database column used to support history and 'As of' queries. This column is a timestamp range
- * or equivalent.
- */
- String getAsOfSysPeriod();
-
/**
* Set the database column used to support history and 'As of' queries. This column is a timestamp range
* or equivalent.
*/
void setAsOfSysPeriod(String asOfSysPeriod);
- /**
- * Return the history table suffix (defaults to _history).
- */
- String getHistoryTableSuffix();
-
/**
* Set the history table suffix.
*/
void setHistoryTableSuffix(String historyTableSuffix);
- /**
- * Return true if we are running in a JTA Transaction manager.
- */
- boolean isUseJtaTransactionManager();
-
/**
* Set to true if we are running in a JTA Transaction manager.
*/
void setUseJtaTransactionManager(boolean useJtaTransactionManager);
- /**
- * Return the external transaction manager.
- */
- ExternalTransactionManager getExternalTransactionManager();
-
/**
* Set the external transaction manager.
*/
void setExternalTransactionManager(ExternalTransactionManager externalTransactionManager);
- /**
- * Return the ServerCachePlugin.
- */
- ServerCachePlugin getServerCachePlugin();
-
/**
* Set the ServerCachePlugin to use.
*/
void setServerCachePlugin(ServerCachePlugin serverCachePlugin);
- /**
- * Return true if LOB's should default to fetch eager.
- * By default this is set to false and LOB's must be explicitly fetched.
- */
- boolean isEagerFetchLobs();
-
/**
* Set to true if you want LOB's to be fetch eager by default.
* By default this is set to false and LOB's must be explicitly fetched.
*/
void setEagerFetchLobs(boolean eagerFetchLobs);
- /**
- * Return the max call stack to use for origin location.
- */
- int getMaxCallStack();
-
/**
* Set the max call stack to use for origin location.
*/
void setMaxCallStack(int maxCallStack);
- /**
- * Return true if transactions should rollback on checked exceptions.
- */
- boolean isTransactionRollbackOnChecked();
-
/**
* Set to true if transactions should by default rollback on checked exceptions.
*/
void setTransactionRollbackOnChecked(boolean transactionRollbackOnChecked);
- /**
- * Return the Background executor schedule pool size. Defaults to 1.
- */
- int getBackgroundExecutorSchedulePoolSize();
-
/**
* Set the Background executor schedule pool size.
*/
void setBackgroundExecutorSchedulePoolSize(int backgroundExecutorSchedulePoolSize);
- /**
- * Return the Background executor shutdown seconds. This is the time allowed for the pool to shutdown nicely
- * before it is forced shutdown.
- */
- int getBackgroundExecutorShutdownSecs();
-
/**
* Set the Background executor shutdown seconds. This is the time allowed for the pool to shutdown nicely
* before it is forced shutdown.
*/
void setBackgroundExecutorShutdownSecs(int backgroundExecutorShutdownSecs);
- /**
- * Return the background executor wrapper.
- */
- BackgroundExecutorWrapper getBackgroundExecutorWrapper();
-
/**
* Sets the background executor wrapper. The wrapper is used when a task is sent to background and should copy the thread-locals.
*/
void setBackgroundExecutorWrapper(BackgroundExecutorWrapper backgroundExecutorWrapper);
- /**
- * Return the L2 cache default max size.
- */
- int getCacheMaxSize();
-
/**
* Set the L2 cache default max size.
*/
void setCacheMaxSize(int cacheMaxSize);
- /**
- * Return the L2 cache default max idle time in seconds.
- */
- int getCacheMaxIdleTime();
-
/**
* Set the L2 cache default max idle time in seconds.
*/
void setCacheMaxIdleTime(int cacheMaxIdleTime);
- /**
- * Return the L2 cache default max time to live in seconds.
- */
- int getCacheMaxTimeToLive();
-
/**
* Set the L2 cache default max time to live in seconds.
*/
void setCacheMaxTimeToLive(int cacheMaxTimeToLive);
- /**
- * Return the L2 query cache default max size.
- */
- int getQueryCacheMaxSize();
-
/**
* Set the L2 query cache default max size.
*/
void setQueryCacheMaxSize(int queryCacheMaxSize);
- /**
- * Return the L2 query cache default max idle time in seconds.
- */
- int getQueryCacheMaxIdleTime();
-
/**
* Set the L2 query cache default max idle time in seconds.
*/
void setQueryCacheMaxIdleTime(int queryCacheMaxIdleTime);
- /**
- * Return the L2 query cache default max time to live in seconds.
- */
- int getQueryCacheMaxTimeToLive();
-
/**
* Set the L2 query cache default max time to live in seconds.
*/
void setQueryCacheMaxTimeToLive(int queryCacheMaxTimeToLive);
- /**
- * Return the NamingConvention.
- *
- * If none has been set the default UnderscoreNamingConvention is used.
- */
- NamingConvention getNamingConvention();
-
/**
* Set the NamingConvention.
*
@@ -799,11 +462,6 @@ public interface DatabaseBuilder {
*/
void setNamingConvention(NamingConvention namingConvention);
- /**
- * Return true if all DB column and table names should use quoted identifiers.
- */
- boolean isAllQuotedIdentifiers();
-
/**
* Set to true if all DB column and table names should use quoted identifiers.
*
@@ -812,71 +470,36 @@ public interface DatabaseBuilder {
*/
void setAllQuotedIdentifiers(boolean allQuotedIdentifiers);
- /**
- * Return true if this Database is a Document store only instance (has no JDBC DB).
- */
- boolean isDocStoreOnly();
-
/**
* Set to true if this Database is Document store only instance (has no JDBC DB).
*/
void setDocStoreOnly(boolean docStoreOnly);
- /**
- * Return the configuration for the ElasticSearch integration.
- */
- DocStoreConfig getDocStoreConfig();
-
/**
* Set the configuration for the ElasticSearch integration.
*/
void setDocStoreConfig(DocStoreConfig docStoreConfig);
- /**
- * Return the constraint naming convention used in DDL generation.
- */
- DbConstraintNaming getConstraintNaming();
-
/**
* Set the constraint naming convention used in DDL generation.
*/
void setConstraintNaming(DbConstraintNaming constraintNaming);
- /**
- * Return the configuration for AutoTune.
- */
- AutoTuneConfig getAutoTuneConfig();
-
/**
* Set the configuration for AutoTune.
*/
void setAutoTuneConfig(AutoTuneConfig autoTuneConfig);
- /**
- * Return true if the startup DataSource check should be skipped.
- */
- boolean skipDataSourceCheck();
-
/**
* Set to true to skip the startup DataSource check.
*/
void setSkipDataSourceCheck(boolean skipDataSourceCheck);
- /**
- * Return the DataSource.
- */
- DataSource getDataSource();
-
/**
* Set a DataSource.
*/
void setDataSource(DataSource dataSource);
- /**
- * Return the read only DataSource.
- */
- DataSource getReadOnlyDataSource();
-
/**
* Set the read only DataSource.
*
@@ -888,53 +511,22 @@ public interface DatabaseBuilder {
*/
void setReadOnlyDataSource(DataSource readOnlyDataSource);
- /**
- * Return the configuration to build a DataSource using Ebean's own DataSource
- * implementation.
- */
- DataSourceBuilder getDataSourceConfig();
-
/**
* Set the configuration required to build a DataSource using Ebean's own
* DataSource implementation.
*/
void setDataSourceConfig(DataSourceBuilder dataSourceConfig);
- /**
- * Return true if Ebean should create a DataSource for use with implicit read only transactions.
- */
- boolean isAutoReadOnlyDataSource();
-
/**
* Set to true if Ebean should create a DataSource for use with implicit read only transactions.
*/
void setAutoReadOnlyDataSource(boolean autoReadOnlyDataSource);
- /**
- * Return the configuration for the read only DataSource.
- *
- * This is only used if autoReadOnlyDataSource is true.
- *
- * The driver, url, username and password default to the configuration for the main DataSource if they are not
- * set on this configuration. This means there is actually no need to set any configuration here and we only
- * set configuration for url, username and password etc if it is different from the main DataSource.
- */
- DataSourceBuilder getReadOnlyDataSourceConfig();
-
/**
* Set the configuration for the read only DataSource.
*/
void setReadOnlyDataSourceConfig(DataSourceBuilder readOnlyDataSourceConfig);
- /**
- * Return a value used to represent TRUE in the database.
- *
- * This is used for databases that do not support boolean natively.
- *
- * The value returned is either a Integer or a String (e.g. "1", or "T").
- */
- String getDatabaseBooleanTrue();
-
/**
* Set the value to represent TRUE in the database.
*
@@ -944,15 +536,6 @@ public interface DatabaseBuilder {
*/
void setDatabaseBooleanTrue(String databaseTrue);
- /**
- * Return a value used to represent FALSE in the database.
- *
- * This is used for databases that do not support boolean natively.
- *
- * The value returned is either a Integer or a String (e.g. "0", or "F").
- */
- String getDatabaseBooleanFalse();
-
/**
* Set the value to represent FALSE in the database.
*
@@ -962,11 +545,6 @@ public interface DatabaseBuilder {
*/
void setDatabaseBooleanFalse(String databaseFalse);
- /**
- * Return the number of DB sequence values that should be preallocated.
- */
- int getDatabaseSequenceBatchSize();
-
/**
* Set the number of DB sequence values that should be preallocated and cached
* by Ebean.
@@ -982,14 +560,6 @@ public interface DatabaseBuilder {
*/
void setDatabaseSequenceBatch(int databaseSequenceBatchSize);
- /**
- * Return the database platform name (can be null).
- *
- * If null then the platform is determined automatically via the JDBC driver
- * information.
- */
- String getDatabasePlatformName();
-
/**
* Explicitly set the database platform name
*
@@ -1005,11 +575,6 @@ public interface DatabaseBuilder {
*/
void setDatabasePlatformName(String databasePlatformName);
- /**
- * Return the database platform to use for this database.
- */
- DatabasePlatform getDatabasePlatform();
-
/**
* Explicitly set the database platform to use.
*
@@ -1018,21 +583,11 @@ public interface DatabaseBuilder {
*/
void setDatabasePlatform(DatabasePlatform databasePlatform);
- /**
- * Return the preferred DB platform IdType.
- */
- IdType getIdType();
-
/**
* Set the preferred DB platform IdType.
*/
void setIdType(IdType idType);
- /**
- * Return the EncryptKeyManager.
- */
- EncryptKeyManager getEncryptKeyManager();
-
/**
* Set the EncryptKeyManager.
*
@@ -1047,14 +602,6 @@ public interface DatabaseBuilder {
*/
void setEncryptKeyManager(EncryptKeyManager encryptKeyManager);
- /**
- * Return the EncryptDeployManager.
- *
- * This is optionally used to programmatically define which columns are
- * encrypted instead of using the {@link Encrypted} Annotation.
- */
- EncryptDeployManager getEncryptDeployManager();
-
/**
* Set the EncryptDeployManager.
*
@@ -1063,12 +610,6 @@ public interface DatabaseBuilder {
*/
void setEncryptDeployManager(EncryptDeployManager encryptDeployManager);
- /**
- * Return the Encryptor used to encrypt data on the java client side (as
- * opposed to DB encryption functions).
- */
- Encryptor getEncryptor();
-
/**
* Set the Encryptor used to encrypt data on the java client side (as opposed
* to DB encryption functions).
@@ -1078,11 +619,6 @@ public interface DatabaseBuilder {
*/
void setEncryptor(Encryptor encryptor);
- /**
- * Return true if the Database instance should be created in offline mode.
- */
- boolean isDbOffline();
-
/**
* Set to true if the Database instance should be created in offline mode.
*
@@ -1091,14 +627,6 @@ public interface DatabaseBuilder {
*/
void setDbOffline(boolean dbOffline);
- /**
- * Return the DbEncrypt used to encrypt and decrypt properties.
- *
- * Note that if this is not set then the DbPlatform may already have a
- * DbEncrypt set and that will be used.
- */
- DbEncrypt getDbEncrypt();
-
/**
* Set the DbEncrypt used to encrypt and decrypt properties.
*
@@ -1107,56 +635,32 @@ public interface DatabaseBuilder {
*/
void setDbEncrypt(DbEncrypt dbEncrypt);
- /**
- * Return the configuration for DB types (such as UUID and custom mappings).
- */
- PlatformConfig getPlatformConfig();
-
/**
* Set the configuration for DB platform (such as UUID and custom mappings).
*/
void setPlatformConfig(PlatformConfig platformConfig);
+
/**
* Set the DB type used to store UUID.
*/
void setDbUuid(PlatformConfig.DbUuid dbUuid);
- /**
- * Returns the UUID version mode.
- */
- DatabaseConfig.UuidVersion getUuidVersion();
-
/**
* Sets the UUID version mode.
*/
void setUuidVersion(DatabaseConfig.UuidVersion uuidVersion);
- /**
- * Return the UUID state file.
- */
- String getUuidStateFile();
-
/**
* Set the UUID state file.
*/
void setUuidStateFile(String uuidStateFile);
- /**
- * Returns the V1-UUID-NodeId
- */
- String getUuidNodeId();
-
/**
* Sets the V1-UUID-NodeId.
*/
void setUuidNodeId(String uuidNodeId);
- /**
- * Return true if LocalTime should be persisted with nanos precision.
- */
- boolean isLocalTimeWithNanos();
-
/**
* Set to true if LocalTime should be persisted with nanos precision.
*
@@ -1164,13 +668,6 @@ public interface DatabaseBuilder {
*/
void setLocalTimeWithNanos(boolean localTimeWithNanos);
- /**
- * Return true if Duration should be persisted with nanos precision (SQL DECIMAL).
- *
- * Otherwise it is persisted with second precision (SQL INTEGER).
- */
- boolean isDurationWithNanos();
-
/**
* Set to true if Duration should be persisted with nanos precision (SQL DECIMAL).
*
@@ -1186,11 +683,6 @@ public interface DatabaseBuilder {
*/
void setRunMigration(boolean runMigration);
- /**
- * Return true if the DB migration should run on server start.
- */
- boolean isRunMigration();
-
/**
* Set to true to generate the "create all" DDL on startup.
*
@@ -1214,14 +706,6 @@ public interface DatabaseBuilder {
*/
void setDdlExtra(boolean ddlExtra);
- /**
- * Return true if the "drop all ddl" should be skipped.
- *
- * Typically we want to do this when using H2 (in memory) as our test database and the drop statements
- * are not required so skipping the drop table statements etc makes it faster with less noise in the logs.
- */
- boolean isDdlCreateOnly();
-
/**
* Set to true if the "drop all ddl" should be skipped.
*
@@ -1230,14 +714,6 @@ public interface DatabaseBuilder {
*/
void setDdlCreateOnly(boolean ddlCreateOnly);
- /**
- * Return SQL script to execute after the "create all" DDL has been run.
- *
- * Typically this is a sql script that inserts test seed data when running tests.
- * Place a sql script in src/test/resources that inserts test seed data.
- */
- String getDdlSeedSql();
-
/**
* Set a SQL script to execute after the "create all" DDL has been run.
*
@@ -1246,41 +722,16 @@ public interface DatabaseBuilder {
*/
void setDdlSeedSql(String ddlSeedSql);
- /**
- * Return a SQL script to execute before the "create all" DDL has been run.
- */
- String getDdlInitSql();
-
/**
* Set a SQL script to execute before the "create all" DDL has been run.
*/
void setDdlInitSql(String ddlInitSql);
- /**
- * Return true if the DDL should be generated.
- */
- boolean isDdlGenerate();
-
- /**
- * Return true if the DDL should be run.
- */
- boolean isDdlRun();
-
- /**
- * Return true, if extra-ddl.xml should be executed.
- */
- boolean isDdlExtra();
-
/**
* Set the header to use with DDL generation.
*/
void setDdlHeader(String ddlHeader);
- /**
- * Return the header to use with DDL generation.
- */
- String getDdlHeader();
-
/**
* Return true if strict mode is used which includes a check that non-null columns have a default value.
*/
@@ -1291,31 +742,16 @@ public interface DatabaseBuilder {
*/
void setDdlStrictMode(boolean ddlStrictMode);
- /**
- * Return a comma and equals delimited placeholders that are substituted in DDL scripts.
- */
- String getDdlPlaceholders();
-
/**
* Set a comma and equals delimited placeholders that are substituted in DDL scripts.
*/
void setDdlPlaceholders(String ddlPlaceholders);
- /**
- * Return a map of placeholder values that are substituted in DDL scripts.
- */
- Map getDdlPlaceholderMap();
-
/**
* Set a map of placeholder values that are substituted in DDL scripts.
*/
void setDdlPlaceholderMap(Map ddlPlaceholderMap);
- /**
- * Return true if the class path search should be disabled.
- */
- boolean isDisableClasspathSearch();
-
/**
* Set to true to disable the class path search even for the case where no entity bean classes
* have been registered. This can be used to start an Database instance just to use the
@@ -1323,11 +759,6 @@ public interface DatabaseBuilder {
*/
void setDisableClasspathSearch(boolean disableClasspathSearch);
- /**
- * Return the mode to use for Joda LocalTime support 'normal' or 'utc'.
- */
- String getJodaLocalTimeMode();
-
/**
* Set the mode to use for Joda LocalTime support 'normal' or 'utc'.
*/
@@ -1358,13 +789,6 @@ public interface DatabaseBuilder {
*/
void addPackage(String packageName);
- /**
- * Return packages to search for entities via class path search.
- *
- * This is only used if classes have not been explicitly specified.
- */
- List getPackages();
-
/**
* Set packages to search for entities via class path search.
*
@@ -1383,77 +807,11 @@ public interface DatabaseBuilder {
*/
void setClasses(Collection> classes);
- /**
- * Return the classes registered for this database. Typically, this includes
- * entities and perhaps listeners.
- */
- Set> classes();
-
- /**
- * @deprecated - migrate to {@link #classes()}.
- *
- * Sorry if returning Set rather than List breaks code but it feels safer to
- * do that than a subtle change to return a shallow copy which you will not detect.
- */
- @Deprecated(forRemoval = true)
- Set> getClasses();
-
- /**
- * Return true if L2 bean cache should be skipped once writes have occurred on a transaction.
- *
- * This defaults to true and means that for "find by id" and "find by natural key"
- * queries that normally hit L2 bean cache automatically will not do so after a write/persist
- * on the transaction.
- *
- *
{@code
- *
- * // assume Customer has L2 bean caching enabled ...
- *
- * try (Transaction transaction = DB.beginTransaction()) {
- *
- * // this uses L2 bean cache as the transaction
- * // ... is considered "query only" at this point
- * Customer.find.byId(42);
- *
- * // transaction no longer "query only" once
- * // ... a bean has been saved etc
- * DB.save(someBean);
- *
- * // will NOT use L2 bean cache as the transaction
- * // ... is no longer considered "query only"
- * Customer.find.byId(55);
- *
- *
- *
- * // explicit control - please use L2 bean cache
- *
- * transaction.setSkipCache(false);
- * Customer.find.byId(77); // hit the l2 bean cache
- *
- *
- * // explicit control - please don't use L2 bean cache
- *
- * transaction.setSkipCache(true);
- * Customer.find.byId(99); // skips l2 bean cache
- *
- * }
- *
- * }
- *
- * @see Transaction#setSkipCache(boolean)
- */
- boolean isSkipCacheAfterWrite();
-
/**
* Set to false when we still want to hit the cache after a write has occurred on a transaction.
*/
void setSkipCacheAfterWrite(boolean skipCacheAfterWrite);
- /**
- * Returns true if updates in JDBC batch default to include all properties by default.
- */
- boolean isUpdateAllPropertiesInBatch();
-
/**
* Set to false if by default updates in JDBC batch should not include all properties.
*
@@ -1463,16 +821,12 @@ public interface DatabaseBuilder {
*/
void setUpdateAllPropertiesInBatch(boolean updateAllPropertiesInBatch);
- /**
- * Returns the resource directory.
- */
- String getResourceDirectory();
-
/**
* Sets the resource directory.
*/
void setResourceDirectory(String resourceDirectory);
+
/**
* Add a custom type mapping.
*
@@ -1518,11 +872,6 @@ public interface DatabaseBuilder {
*/
void add(BeanQueryAdapter beanQueryAdapter);
- /**
- * Return the BeanQueryAdapter instances.
- */
- List getQueryAdapters();
-
/**
* Register all the BeanQueryAdapter instances.
*
@@ -1531,11 +880,6 @@ public interface DatabaseBuilder {
*/
void setQueryAdapters(List queryAdapters);
- /**
- * Return the custom IdGenerator instances.
- */
- List getIdGenerators();
-
/**
* Set the custom IdGenerator instances.
*/
@@ -1570,41 +914,21 @@ public interface DatabaseBuilder {
*/
void add(BeanPostConstructListener listener);
- /**
- * Return the list of BeanFindController instances.
- */
- List getFindControllers();
-
/**
* Set the list of BeanFindController instances.
*/
void setFindControllers(List findControllers);
- /**
- * Return the list of BeanPostLoader instances.
- */
- List getPostLoaders();
-
/**
* Set the list of BeanPostLoader instances.
*/
void setPostLoaders(List postLoaders);
- /**
- * Return the list of BeanPostLoader instances.
- */
- List getPostConstructListeners();
-
/**
* Set the list of BeanPostLoader instances.
*/
void setPostConstructListeners(List listeners);
- /**
- * Return the BeanPersistController instances.
- */
- List getPersistControllers();
-
/**
* Register all the BeanPersistController instances.
*
@@ -1621,31 +945,16 @@ public interface DatabaseBuilder {
*/
void add(BeanPersistListener beanPersistListener);
- /**
- * Return the BeanPersistListener instances.
- */
- List getPersistListeners();
-
/**
* Add a BulkTableEventListener
*/
void add(BulkTableEventListener bulkTableEventListener);
- /**
- * Return the list of BulkTableEventListener instances.
- */
- List getBulkTableEventListeners();
-
/**
* Add a ServerConfigStartup.
*/
void addServerConfigStartup(ServerConfigStartup configStartupListener);
- /**
- * Return the list of ServerConfigStartup instances.
- */
- List getServerConfigStartupListeners();
-
/**
* Register all the BeanPersistListener instances.
*
@@ -1654,17 +963,6 @@ public interface DatabaseBuilder {
*/
void setPersistListeners(List persistListeners);
- /**
- * Return the default PersistenceContextScope to be used if one is not explicitly set on a query.
- *
- * The PersistenceContextScope can specified on each query via {@link io.ebean
- * .Query#setPersistenceContextScope(io.ebean.PersistenceContextScope)}. If it
- * is not set on the query this default scope is used.
- *
- * @see Query#setPersistenceContextScope(PersistenceContextScope)
- */
- PersistenceContextScope getPersistenceContextScope();
-
/**
* Set the PersistenceContext scope to be used if one is not explicitly set on a query.
*
@@ -1678,12 +976,6 @@ public interface DatabaseBuilder {
*/
void setPersistenceContextScope(PersistenceContextScope persistenceContextScope);
- /**
- * Return the ClassLoadConfig which is used to detect Joda, Java8 types etc and also
- * create new instances of plugins given a className.
- */
- ClassLoadConfig getClassLoadConfig();
-
/**
* Set the ClassLoadConfig which is used to detect Joda, Java8 types etc and also
* create new instances of plugins given a className.
@@ -1703,24 +995,12 @@ public interface DatabaseBuilder {
*/
void loadFromProperties(Properties properties);
- /**
- * Return the properties that we used for configuration and were set via a call to loadFromProperties().
- */
- Properties getProperties();
-
/**
* Return the PersistBatch mode to use for 'batchOnCascade' taking into account if the database
* platform supports getGeneratedKeys in batch mode.
*/
PersistBatch appliedPersistBatchOnCascade();
- /**
- * Return the Jackson ObjectMapper.
- *
- * Note that this is not strongly typed as Jackson ObjectMapper is an optional dependency.
- */
- Object getObjectMapper();
-
/**
* Set the Jackson ObjectMapper.
*
@@ -1728,11 +1008,6 @@ public interface DatabaseBuilder {
*/
void setObjectMapper(Object objectMapper);
- /**
- * Return true if eq("someProperty", null) should to generate "1=1" rather than "is null" sql expression.
- */
- boolean isExpressionEqualsWithNullAsNoop();
-
/**
* Set to true if you want eq("someProperty", null) to generate "1=1" rather than "is null" sql expression.
*
@@ -1742,51 +1017,26 @@ public interface DatabaseBuilder {
*/
void setExpressionEqualsWithNullAsNoop(boolean expressionEqualsWithNullAsNoop);
- /**
- * Return true if native ILIKE expression should be used if supported by the database platform (e.g. Postgres).
- */
- boolean isExpressionNativeIlike();
-
/**
* Set to true to use native ILIKE expression if supported by the database platform (e.g. Postgres).
*/
void setExpressionNativeIlike(boolean expressionNativeIlike);
- /**
- * Return the enabled L2 cache regions.
- */
- String getEnabledL2Regions();
-
/**
* Set the enabled L2 cache regions (comma delimited).
*/
void setEnabledL2Regions(String enabledL2Regions);
- /**
- * Return true if L2 cache is disabled.
- */
- boolean isDisableL2Cache();
-
/**
* Set to true to disable L2 caching. Typically useful in performance testing.
*/
void setDisableL2Cache(boolean disableL2Cache);
- /**
- * Return true to use local only L2 cache. Effectively ignore l2 cache plugin like ebean-redis etc.
- */
- boolean isLocalOnlyL2Cache();
-
/**
* Force the use of local only L2 cache. Effectively ignore l2 cache plugin like ebean-redis etc.
*/
void setLocalOnlyL2Cache(boolean localOnlyL2Cache);
- /**
- * Returns if we use javax.validation.constraints.NotNull
- */
- boolean isUseValidationNotNull();
-
/**
* Controls if Ebean should ignore &x64;javax.validation.contstraints.NotNull or
* &x64;jakarta.validation.contstraints.NotNull
@@ -1798,11 +1048,6 @@ public interface DatabaseBuilder {
*/
void setUseValidationNotNull(boolean useValidationNotNull);
- /**
- * Return true if L2 cache notification should run in the foreground.
- */
- boolean isNotifyL2CacheInForeground();
-
/**
* Set this to true to run L2 cache notification in the foreground.
*
@@ -1812,11 +1057,6 @@ public interface DatabaseBuilder {
*/
void setNotifyL2CacheInForeground(boolean notifyL2CacheInForeground);
- /**
- * Return the time to live for ebean's internal query plan.
- */
- int getQueryPlanTTLSeconds();
-
/**
* Set the time to live for ebean's internal query plan.
*
@@ -1843,11 +1083,6 @@ public interface DatabaseBuilder {
*/
void addMappingLocation(String mappingLocation);
- /**
- * Return mapping locations to search for xml mapping via class path search.
- */
- List getMappingLocations();
-
/**
* Set mapping locations to search for xml mapping via class path search.
*
@@ -1855,34 +1090,17 @@ public interface DatabaseBuilder {
*/
void setMappingLocations(List mappingLocations);
- /**
- * When false we need explicit @GeneratedValue mapping to assign
- * Identity or Sequence generated values. When true Id properties are automatically
- * assigned Identity or Sequence without the GeneratedValue mapping.
- */
- boolean isIdGeneratorAutomatic();
-
/**
* Set to false such that Id properties require explicit @GeneratedValue
* mapping before they are assigned Identity or Sequence generation based on platform.
*/
void setIdGeneratorAutomatic(boolean idGeneratorAutomatic);
- /**
- * Return true if query plan capture is enabled.
- */
- boolean isQueryPlanEnable();
-
/**
* Set to true to enable query plan capture.
*/
void setQueryPlanEnable(boolean queryPlanEnable);
- /**
- * Return the query plan collection threshold in microseconds.
- */
- long getQueryPlanThresholdMicros();
-
/**
* Set the query plan collection threshold in microseconds.
*
@@ -1891,35 +1109,16 @@ public interface DatabaseBuilder {
*/
void setQueryPlanThresholdMicros(long queryPlanThresholdMicros);
- /**
- * Return true if periodic capture of query plans is enabled.
- */
- boolean isQueryPlanCapture();
-
/**
* Set to true to turn on periodic capture of query plans.
*/
void setQueryPlanCapture(boolean queryPlanCapture);
- /**
- * Return the frequency to capture query plans.
- */
- long getQueryPlanCapturePeriodSecs();
-
/**
* Set the frequency in seconds to capture query plans.
*/
void setQueryPlanCapturePeriodSecs(long queryPlanCapturePeriodSecs);
- /**
- * Return the time after which a capture query plans request will
- * stop capturing more query plans.
- *
- * Effectively this controls the amount of load/time we want to
- * allow for query plan capture.
- */
- long getQueryPlanCaptureMaxTimeMillis();
-
/**
* Set the time after which a capture query plans request will
* stop capturing more query plans.
@@ -1929,41 +1128,21 @@ public interface DatabaseBuilder {
*/
void setQueryPlanCaptureMaxTimeMillis(long queryPlanCaptureMaxTimeMillis);
- /**
- * Return the max number of query plans captured per request.
- */
- int getQueryPlanCaptureMaxCount();
-
/**
* Set the max number of query plans captured per request.
*/
void setQueryPlanCaptureMaxCount(int queryPlanCaptureMaxCount);
- /**
- * Return the listener used to process captured query plans.
- */
- QueryPlanListener getQueryPlanListener();
-
/**
* Set the listener used to process captured query plans.
*/
void setQueryPlanListener(QueryPlanListener queryPlanListener);
- /**
- * Return true if metrics should be dumped when the server is shutdown.
- */
- boolean isDumpMetricsOnShutdown();
-
/**
* Set to true if metrics should be dumped when the server is shutdown.
*/
void setDumpMetricsOnShutdown(boolean dumpMetricsOnShutdown);
- /**
- * Return the options for dumping metrics.
- */
- String getDumpMetricsOptions();
-
/**
* Include 'sql' or 'hash' in options such that they are included in the output.
*
@@ -1972,15 +1151,7 @@ public interface DatabaseBuilder {
void setDumpMetricsOptions(String dumpMetricsOptions);
/**
- * Return true if entity classes should be loaded and registered via EntityClassRegister.
- *
- * When false we either register entity classes via application code or use classpath
- * scanning to find and register entity classes.
- */
- boolean isLoadModuleInfo();
-
- /**
- * @deprecated - migrate to {@link #isLoadModuleInfo()}.
+ * @deprecated - migrate to {@link Settings#isLoadModuleInfo()}.
*/
@Deprecated(forRemoval = true)
boolean isAutoLoadModuleInfo();
@@ -1994,13 +1165,859 @@ public interface DatabaseBuilder {
*/
void setLoadModuleInfo(boolean loadModuleInfo);
- /**
- * Return the naming convention to apply to metrics names.
- */
- Function getMetricNaming();
-
/**
* Set the naming convention to apply to metrics names.
*/
void setMetricNaming(Function metricNaming);
+
+
+ /**
+ * Provides read access (getters) for the DatabaseBuilder configuration
+ * that has been set.
+ */
+ interface Settings extends DatabaseBuilder {
+
+ /**
+ * Return the Jackson JsonFactory to use.
+ *
+ * If not set a default implementation will be used.
+ */
+ JsonFactory getJsonFactory();
+
+ /**
+ * Get the clock used for setting the timestamps (e.g. @UpdatedTimestamp) on objects.
+ */
+ Clock getClock();
+
+ /**
+ * Return the slow query time in millis.
+ */
+ long getSlowQueryMillis();
+
+ /**
+ * Return the slow query event listener.
+ */
+ SlowQueryListener getSlowQueryListener();
+
+ /**
+ * Return the service object given the key.
+ */
+ Object getServiceObject(String key);
+
+ /**
+ * Used by ebean or plugins to obtain service objects.
+ *
+ *
{@code
+ *
+ * JedisPool jedisPool = config.getServiceObject(JedisPool.class);
+ *
+ * }
+ *
+ * @param cls The type of the service object to obtain
+ * @return The service object given the class type
+ */
+ @SuppressWarnings("unchecked")
+ P getServiceObject(Class
cls);
+
+ /**
+ * Return the JSON format used for DateTime types.
+ */
+ JsonConfig.DateTime getJsonDateTime();
+
+ /**
+ * Return the JSON format used for Date types.
+ */
+ JsonConfig.Date getJsonDate();
+
+ /**
+ * Return the JSON include mode used when writing JSON.
+ */
+ JsonConfig.Include getJsonInclude();
+
+ /**
+ * Return the default MutableDetection to use with {@code @DbJson} using Jackson.
+ *
+ * @see DbJson#mutationDetection()
+ */
+ MutationDetection getJsonMutationDetection();
+
+ /**
+ * Return the name of the Database.
+ */
+ String getName();
+
+ /**
+ * Return the container / clustering configuration.
+ *
+ * The container holds all the Database instances and provides clustering communication
+ * services to all the Database instances.
+ */
+ ContainerConfig getContainerConfig();
+
+ /**
+ * Return true if this server should be registered with the Ebean singleton
+ * when it is created.
+ *
+ * By default this is set to true.
+ */
+ boolean isRegister();
+
+ /**
+ * Return true if this server should be registered as the "default" server
+ * with the Ebean singleton.
+ *
+ * This is only used when {@link #setRegister(boolean)} is also true.
+ */
+ boolean isDefaultServer();
+
+ /**
+ * Return the CurrentUserProvider. This is used to populate @WhoCreated, @WhoModified and
+ * support other audit features (who executed a query etc).
+ */
+ CurrentUserProvider getCurrentUserProvider();
+
+ /**
+ * Return the tenancy mode used.
+ */
+ TenantMode getTenantMode();
+
+ /**
+ * Return the column name used for TenantMode.PARTITION.
+ */
+ String getTenantPartitionColumn();
+
+ /**
+ * Return the current tenant provider.
+ */
+ CurrentTenantProvider getCurrentTenantProvider();
+
+ /**
+ * Return the tenancy datasource provider.
+ */
+ TenantDataSourceProvider getTenantDataSourceProvider();
+
+ /**
+ * Return the tenancy schema provider.
+ */
+ TenantSchemaProvider getTenantSchemaProvider();
+
+ /**
+ * Return the PersistBatch mode to use by default at the transaction level.
+ *
+ * When INSERT or ALL is used then save(), delete() etc do not execute immediately but instead go into
+ * a JDBC batch execute buffer that is flushed. The buffer is flushed if a query is executed, transaction ends
+ * or the batch size is meet.
+ */
+ PersistBatch getPersistBatch();
+
+ /**
+ * Return the JDBC batch mode to use per save(), delete(), insert() or update() request.
+ *
+ * This makes sense when a save() or delete() cascades and executes multiple child statements. The best case
+ * for this is when saving a master/parent bean this cascade inserts many detail/child beans.
+ *
+ * This only takes effect when the persistBatch mode at the transaction level does not take effect.
+ */
+ PersistBatch getPersistBatchOnCascade();
+
+ /**
+ * Return the batch size used for JDBC batching. This defaults to 20.
+ */
+ int getPersistBatchSize();
+
+ /**
+ * Gets the query batch size. This defaults to 100.
+ *
+ * @return the query batch size
+ */
+ int getQueryBatchSize();
+
+ EnumType getDefaultEnumType();
+
+ /**
+ * Return true if lazy loading is disabled on queries by default.
+ */
+ boolean isDisableLazyLoading();
+
+ /**
+ * Return the default batch size for lazy loading of beans and collections.
+ */
+ int getLazyLoadBatchSize();
+
+
+ /**
+ * Return the default JDBC fetchSize hint for findList queries.
+ */
+ int getJdbcFetchSizeFindList();
+
+ /**
+ * Return the default JDBC fetchSize hint for findEach/findEachWhile queries.
+ */
+ int getJdbcFetchSizeFindEach();
+
+ /**
+ * Return the ChangeLogPrepare.
+ *
+ * This is used to set user context information to the ChangeSet in the
+ * foreground thread prior to the logging occurring in a background thread.
+ */
+ ChangeLogPrepare getChangeLogPrepare();
+
+ /**
+ * Return the ChangeLogListener which actually performs the logging of change sets
+ * in the background.
+ */
+ ChangeLogListener getChangeLogListener();
+
+ /**
+ * Return the ChangeLogRegister which controls which ChangeLogFilter is used for each
+ * bean type and in this way provide fine grained control over which persist requests
+ * are included in the change log.
+ */
+ ChangeLogRegister getChangeLogRegister();
+
+ /**
+ * Return true if inserts should be included in the change log by default.
+ */
+ boolean isChangeLogIncludeInserts();
+
+ /**
+ * Return true (default) if the changelog should be written async.
+ */
+ boolean isChangeLogAsync();
+
+ /**
+ * Return the ReadAuditLogger to use.
+ */
+ ReadAuditLogger getReadAuditLogger();
+
+ /**
+ * Return the ReadAuditPrepare to use.
+ */
+ ReadAuditPrepare getReadAuditPrepare();
+
+ /**
+ * Return the configuration for profiling.
+ */
+ ProfilingConfig getProfilingConfig();
+
+ /**
+ * Return the DB schema to use.
+ */
+ String getDbSchema();
+
+ /**
+ * Return the Geometry SRID.
+ */
+ int getGeometrySRID();
+
+ /**
+ * Return the time zone to use when reading/writing Timestamps via JDBC.
+ *
+ * When set a Calendar object is used in JDBC calls when reading/writing Timestamp objects.
+ */
+ String getDataTimeZone();
+
+ /**
+ * Return the suffix appended to the base table to derive the view that contains the union
+ * of the base table and the history table in order to support asOf queries.
+ */
+ String getAsOfViewSuffix();
+
+ /**
+ * Return the database column used to support history and 'As of' queries. This column is a timestamp range
+ * or equivalent.
+ */
+ String getAsOfSysPeriod();
+
+ /**
+ * Return the history table suffix (defaults to _history).
+ */
+ String getHistoryTableSuffix();
+
+ /**
+ * Return true if we are running in a JTA Transaction manager.
+ */
+ boolean isUseJtaTransactionManager();
+
+ /**
+ * Return the external transaction manager.
+ */
+ ExternalTransactionManager getExternalTransactionManager();
+
+ /**
+ * Return the ServerCachePlugin.
+ */
+ ServerCachePlugin getServerCachePlugin();
+
+ /**
+ * Return true if LOB's should default to fetch eager.
+ * By default this is set to false and LOB's must be explicitly fetched.
+ */
+ boolean isEagerFetchLobs();
+
+ /**
+ * Return the max call stack to use for origin location.
+ */
+ int getMaxCallStack();
+
+ /**
+ * Return true if transactions should rollback on checked exceptions.
+ */
+ boolean isTransactionRollbackOnChecked();
+
+ /**
+ * Return the Background executor schedule pool size. Defaults to 1.
+ */
+ int getBackgroundExecutorSchedulePoolSize();
+
+ /**
+ * Return the Background executor shutdown seconds. This is the time allowed for the pool to shutdown nicely
+ * before it is forced shutdown.
+ */
+ int getBackgroundExecutorShutdownSecs();
+
+ /**
+ * Return the background executor wrapper.
+ */
+ BackgroundExecutorWrapper getBackgroundExecutorWrapper();
+
+ /**
+ * Return the L2 cache default max size.
+ */
+ int getCacheMaxSize();
+
+ /**
+ * Return the L2 cache default max idle time in seconds.
+ */
+ int getCacheMaxIdleTime();
+
+ /**
+ * Return the L2 cache default max time to live in seconds.
+ */
+ int getCacheMaxTimeToLive();
+
+ /**
+ * Return the L2 query cache default max size.
+ */
+ int getQueryCacheMaxSize();
+
+ /**
+ * Return the L2 query cache default max idle time in seconds.
+ */
+ int getQueryCacheMaxIdleTime();
+
+ /**
+ * Return the L2 query cache default max time to live in seconds.
+ */
+ int getQueryCacheMaxTimeToLive();
+
+ /**
+ * Return the NamingConvention.
+ *
+ * If none has been set the default UnderscoreNamingConvention is used.
+ */
+ NamingConvention getNamingConvention();
+
+ /**
+ * Return true if all DB column and table names should use quoted identifiers.
+ */
+ boolean isAllQuotedIdentifiers();
+
+ /**
+ * Return true if this Database is a Document store only instance (has no JDBC DB).
+ */
+ boolean isDocStoreOnly();
+
+ /**
+ * Return the configuration for the ElasticSearch integration.
+ */
+ DocStoreConfig getDocStoreConfig();
+
+ /**
+ * Return the constraint naming convention used in DDL generation.
+ */
+ DbConstraintNaming getConstraintNaming();
+
+ /**
+ * Return the configuration for AutoTune.
+ */
+ AutoTuneConfig getAutoTuneConfig();
+
+ /**
+ * Return true if the startup DataSource check should be skipped.
+ */
+ boolean skipDataSourceCheck();
+
+ /**
+ * Return the DataSource.
+ */
+ DataSource getDataSource();
+
+ /**
+ * Return the read only DataSource.
+ */
+ DataSource getReadOnlyDataSource();
+
+ /**
+ * Return the configuration to build a DataSource using Ebean's own DataSource
+ * implementation.
+ */
+ DataSourceBuilder getDataSourceConfig();
+
+ /**
+ * Return true if Ebean should create a DataSource for use with implicit read only transactions.
+ */
+ boolean isAutoReadOnlyDataSource();
+
+ /**
+ * Return the configuration for the read only DataSource.
+ *
+ * This is only used if autoReadOnlyDataSource is true.
+ *
+ * The driver, url, username and password default to the configuration for the main DataSource if they are not
+ * set on this configuration. This means there is actually no need to set any configuration here and we only
+ * set configuration for url, username and password etc if it is different from the main DataSource.
+ */
+ DataSourceBuilder getReadOnlyDataSourceConfig();
+
+ /**
+ * Return a value used to represent TRUE in the database.
+ *
+ * This is used for databases that do not support boolean natively.
+ *
+ * The value returned is either a Integer or a String (e.g. "1", or "T").
+ */
+ String getDatabaseBooleanTrue();
+
+ /**
+ * Return a value used to represent FALSE in the database.
+ *
+ * This is used for databases that do not support boolean natively.
+ *
+ * The value returned is either a Integer or a String (e.g. "0", or "F").
+ */
+ String getDatabaseBooleanFalse();
+
+ /**
+ * Return the number of DB sequence values that should be preallocated.
+ */
+ int getDatabaseSequenceBatchSize();
+
+ /**
+ * Return the database platform name (can be null).
+ *
+ * If null then the platform is determined automatically via the JDBC driver
+ * information.
+ */
+ String getDatabasePlatformName();
+
+ /**
+ * Return the database platform to use for this database.
+ */
+ DatabasePlatform getDatabasePlatform();
+
+ /**
+ * Return the preferred DB platform IdType.
+ */
+ IdType getIdType();
+
+ /**
+ * Return the EncryptKeyManager.
+ */
+ EncryptKeyManager getEncryptKeyManager();
+
+ /**
+ * Return the EncryptDeployManager.
+ *
+ * This is optionally used to programmatically define which columns are
+ * encrypted instead of using the {@link Encrypted} Annotation.
+ */
+ EncryptDeployManager getEncryptDeployManager();
+
+ /**
+ * Return the Encryptor used to encrypt data on the java client side (as
+ * opposed to DB encryption functions).
+ */
+ Encryptor getEncryptor();
+
+ /**
+ * Return true if the Database instance should be created in offline mode.
+ */
+ boolean isDbOffline();
+
+ /**
+ * Return the DbEncrypt used to encrypt and decrypt properties.
+ *
+ * Note that if this is not set then the DbPlatform may already have a
+ * DbEncrypt set and that will be used.
+ */
+ DbEncrypt getDbEncrypt();
+
+ /**
+ * Return the configuration for DB types (such as UUID and custom mappings).
+ */
+ PlatformConfig getPlatformConfig();
+
+
+ /**
+ * Returns the UUID version mode.
+ */
+ DatabaseConfig.UuidVersion getUuidVersion();
+
+ /**
+ * Return the UUID state file.
+ */
+ String getUuidStateFile();
+
+ /**
+ * Returns the V1-UUID-NodeId
+ */
+ String getUuidNodeId();
+
+ /**
+ * Return true if LocalTime should be persisted with nanos precision.
+ */
+ boolean isLocalTimeWithNanos();
+
+ /**
+ * Return true if Duration should be persisted with nanos precision (SQL DECIMAL).
+ *
+ * Otherwise it is persisted with second precision (SQL INTEGER).
+ */
+ boolean isDurationWithNanos();
+
+ /**
+ * Return true if the DB migration should run on server start.
+ */
+ boolean isRunMigration();
+
+ /**
+ * Return true if the "drop all ddl" should be skipped.
+ *
+ * Typically we want to do this when using H2 (in memory) as our test database and the drop statements
+ * are not required so skipping the drop table statements etc makes it faster with less noise in the logs.
+ */
+ boolean isDdlCreateOnly();
+
+ /**
+ * Return SQL script to execute after the "create all" DDL has been run.
+ *
+ * Typically this is a sql script that inserts test seed data when running tests.
+ * Place a sql script in src/test/resources that inserts test seed data.
+ */
+ String getDdlSeedSql();
+
+ /**
+ * Return a SQL script to execute before the "create all" DDL has been run.
+ */
+ String getDdlInitSql();
+
+ /**
+ * Return true if the DDL should be generated.
+ */
+ boolean isDdlGenerate();
+
+ /**
+ * Return true if the DDL should be run.
+ */
+ boolean isDdlRun();
+
+ /**
+ * Return true, if extra-ddl.xml should be executed.
+ */
+ boolean isDdlExtra();
+
+ /**
+ * Return the header to use with DDL generation.
+ */
+ String getDdlHeader();
+
+ /**
+ * Return a comma and equals delimited placeholders that are substituted in DDL scripts.
+ */
+ String getDdlPlaceholders();
+
+ /**
+ * Return a map of placeholder values that are substituted in DDL scripts.
+ */
+ Map getDdlPlaceholderMap();
+
+ /**
+ * Return true if the class path search should be disabled.
+ */
+ boolean isDisableClasspathSearch();
+
+ /**
+ * Return the mode to use for Joda LocalTime support 'normal' or 'utc'.
+ */
+ String getJodaLocalTimeMode();
+
+ /**
+ * Return packages to search for entities via class path search.
+ *
+ * This is only used if classes have not been explicitly specified.
+ */
+ List getPackages();
+
+ /**
+ * Return the classes registered for this database. Typically, this includes
+ * entities and perhaps listeners.
+ */
+ Set> classes();
+
+ /**
+ * Return true if L2 bean cache should be skipped once writes have occurred on a transaction.
+ *
+ * This defaults to true and means that for "find by id" and "find by natural key"
+ * queries that normally hit L2 bean cache automatically will not do so after a write/persist
+ * on the transaction.
+ *
+ *
{@code
+ *
+ * // assume Customer has L2 bean caching enabled ...
+ *
+ * try (Transaction transaction = DB.beginTransaction()) {
+ *
+ * // this uses L2 bean cache as the transaction
+ * // ... is considered "query only" at this point
+ * Customer.find.byId(42);
+ *
+ * // transaction no longer "query only" once
+ * // ... a bean has been saved etc
+ * DB.save(someBean);
+ *
+ * // will NOT use L2 bean cache as the transaction
+ * // ... is no longer considered "query only"
+ * Customer.find.byId(55);
+ *
+ *
+ *
+ * // explicit control - please use L2 bean cache
+ *
+ * transaction.setSkipCache(false);
+ * Customer.find.byId(77); // hit the l2 bean cache
+ *
+ *
+ * // explicit control - please don't use L2 bean cache
+ *
+ * transaction.setSkipCache(true);
+ * Customer.find.byId(99); // skips l2 bean cache
+ *
+ * }
+ *
+ * }
+ *
+ * @see Transaction#setSkipCache(boolean)
+ */
+ boolean isSkipCacheAfterWrite();
+
+ /**
+ * Returns true if updates in JDBC batch default to include all properties by default.
+ */
+ boolean isUpdateAllPropertiesInBatch();
+
+ /**
+ * Returns the resource directory.
+ */
+ String getResourceDirectory();
+
+ /**
+ * @deprecated - migrate to {@link Settings#classes()}.
+ *
+ * Sorry if returning Set rather than List breaks code but it feels safer to
+ * do that than a subtle change to return a shallow copy which you will not detect.
+ */
+ @Deprecated(forRemoval = true)
+ Set> getClasses();
+
+ /**
+ * Return the BeanQueryAdapter instances.
+ */
+ List getQueryAdapters();
+
+ /**
+ * Return the custom IdGenerator instances.
+ */
+ List getIdGenerators();
+
+ /**
+ * Return the list of BeanFindController instances.
+ */
+ List getFindControllers();
+
+ /**
+ * Return the list of BeanPostLoader instances.
+ */
+ List getPostLoaders();
+
+ /**
+ * Return the list of BeanPostLoader instances.
+ */
+ List getPostConstructListeners();
+
+ /**
+ * Return the BeanPersistController instances.
+ */
+ List getPersistControllers();
+
+ /**
+ * Return the BeanPersistListener instances.
+ */
+ List getPersistListeners();
+
+ /**
+ * Return the list of BulkTableEventListener instances.
+ */
+ List getBulkTableEventListeners();
+
+ /**
+ * Return the list of ServerConfigStartup instances.
+ */
+ List getServerConfigStartupListeners();
+
+ /**
+ * Return the default PersistenceContextScope to be used if one is not explicitly set on a query.
+ *
+ * The PersistenceContextScope can specified on each query via {@link io.ebean
+ * .Query#setPersistenceContextScope(io.ebean.PersistenceContextScope)}. If it
+ * is not set on the query this default scope is used.
+ *
+ * @see Query#setPersistenceContextScope(PersistenceContextScope)
+ */
+ PersistenceContextScope getPersistenceContextScope();
+
+ /**
+ * Return the ClassLoadConfig which is used to detect Joda, Java8 types etc and also
+ * create new instances of plugins given a className.
+ */
+ ClassLoadConfig getClassLoadConfig();
+
+ /**
+ * Return the properties that we used for configuration and were set via a call to loadFromProperties().
+ */
+ Properties getProperties();
+
+ /**
+ * Return the Jackson ObjectMapper.
+ *
+ * Note that this is not strongly typed as Jackson ObjectMapper is an optional dependency.
+ */
+ Object getObjectMapper();
+
+ /**
+ * Return true if eq("someProperty", null) should to generate "1=1" rather than "is null" sql expression.
+ */
+ boolean isExpressionEqualsWithNullAsNoop();
+
+ /**
+ * Return true if native ILIKE expression should be used if supported by the database platform (e.g. Postgres).
+ */
+ boolean isExpressionNativeIlike();
+
+ /**
+ * Return the enabled L2 cache regions.
+ */
+ String getEnabledL2Regions();
+
+ /**
+ * Return true if L2 cache is disabled.
+ */
+ boolean isDisableL2Cache();
+
+ /**
+ * Return true to use local only L2 cache. Effectively ignore l2 cache plugin like ebean-redis etc.
+ */
+ boolean isLocalOnlyL2Cache();
+
+ /**
+ * Returns if we use javax.validation.constraints.NotNull
+ */
+ boolean isUseValidationNotNull();
+
+ /**
+ * Return true if L2 cache notification should run in the foreground.
+ */
+ boolean isNotifyL2CacheInForeground();
+
+ /**
+ * Return the time to live for ebean's internal query plan.
+ */
+ int getQueryPlanTTLSeconds();
+
+ /**
+ * Return mapping locations to search for xml mapping via class path search.
+ */
+ List getMappingLocations();
+
+ /**
+ * When false we need explicit @GeneratedValue mapping to assign
+ * Identity or Sequence generated values. When true Id properties are automatically
+ * assigned Identity or Sequence without the GeneratedValue mapping.
+ */
+ boolean isIdGeneratorAutomatic();
+
+ /**
+ * Return true if query plan capture is enabled.
+ */
+ boolean isQueryPlanEnable();
+
+ /**
+ * Return the query plan collection threshold in microseconds.
+ */
+ long getQueryPlanThresholdMicros();
+
+ /**
+ * Return true if periodic capture of query plans is enabled.
+ */
+ boolean isQueryPlanCapture();
+
+ /**
+ * Return the frequency to capture query plans.
+ */
+ long getQueryPlanCapturePeriodSecs();
+
+ /**
+ * Return the time after which a capture query plans request will
+ * stop capturing more query plans.
+ *
+ * Effectively this controls the amount of load/time we want to
+ * allow for query plan capture.
+ */
+ long getQueryPlanCaptureMaxTimeMillis();
+
+ /**
+ * Return the max number of query plans captured per request.
+ */
+ int getQueryPlanCaptureMaxCount();
+
+ /**
+ * Return the listener used to process captured query plans.
+ */
+ QueryPlanListener getQueryPlanListener();
+
+ /**
+ * Return true if metrics should be dumped when the server is shutdown.
+ */
+ boolean isDumpMetricsOnShutdown();
+
+ /**
+ * Return the options for dumping metrics.
+ */
+ String getDumpMetricsOptions();
+
+ /**
+ * Return true if entity classes should be loaded and registered via EntityClassRegister.
+ *
+ * When false we either register entity classes via application code or use classpath
+ * scanning to find and register entity classes.
+ */
+ boolean isLoadModuleInfo();
+
+ /**
+ * Return the naming convention to apply to metrics names.
+ */
+ Function getMetricNaming();
+
+ }
}
diff --git a/ebean-api/src/main/java/io/ebean/DatabaseFactory.java b/ebean-api/src/main/java/io/ebean/DatabaseFactory.java
index a5eb97d2c..f887c1416 100644
--- a/ebean-api/src/main/java/io/ebean/DatabaseFactory.java
+++ b/ebean-api/src/main/java/io/ebean/DatabaseFactory.java
@@ -75,9 +75,10 @@ public final class DatabaseFactory {
*
* }
*/
- public static Database create(DatabaseBuilder config) {
+ public static Database create(DatabaseBuilder builder) {
lock.lock();
try {
+ var config = builder.settings();
if (config.getName() == null) {
throw new PersistenceException("The name is null (it is required)");
}
@@ -131,7 +132,7 @@ public final class DatabaseFactory {
}
}
- private static Database createInternal(DatabaseBuilder config) {
+ private static Database createInternal(DatabaseBuilder.Settings config) {
return container(config.getContainerConfig()).createServer(config);
}
diff --git a/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java b/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
index 2e3a29d36..0b614f2e5 100644
--- a/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
+++ b/ebean-api/src/main/java/io/ebean/config/DatabaseConfig.java
@@ -61,7 +61,7 @@ import java.util.function.Function;
* @author rbygrave
* @see DatabaseFactory
*/
-public class DatabaseConfig implements DatabaseBuilder {
+public class DatabaseConfig implements DatabaseBuilder.Settings {
/**
* The Database name.
@@ -548,6 +548,11 @@ public class DatabaseConfig implements DatabaseBuilder {
public DatabaseConfig() {
}
+ @Override
+ public Settings settings() {
+ return this;
+ }
+
@Override
public Clock getClock() {
return clock;
diff --git a/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java b/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java
index 9f558571a..59d3dea2c 100644
--- a/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java
+++ b/ebean-api/src/main/java/io/ebean/plugin/SpiServer.java
@@ -16,7 +16,7 @@ public interface SpiServer extends Database {
/**
* Return the DatabaseConfig.
*/
- DatabaseBuilder config();
+ DatabaseBuilder.Settings config();
/**
* Return the DatabasePlatform for this database.
diff --git a/ebean-api/src/test/java/io/ebean/config/DatabaseConfigTest.java b/ebean-api/src/test/java/io/ebean/config/DatabaseConfigTest.java
index 9e19c484a..d816584b2 100644
--- a/ebean-api/src/test/java/io/ebean/config/DatabaseConfigTest.java
+++ b/ebean-api/src/test/java/io/ebean/config/DatabaseConfigTest.java
@@ -18,7 +18,7 @@ class DatabaseConfigTest {
@Test
void testLoadFromEbeanProperties() {
- DatabaseBuilder config = new DatabaseConfig();
+ var config = new DatabaseConfig().settings();
config.loadFromProperties();
assertEquals(PersistBatch.NONE, config.getPersistBatch());
@@ -33,7 +33,7 @@ class DatabaseConfigTest {
Properties props = new Properties();
props.setProperty("ddl.initSql", "${user.home}" + fileSeparator + "initSql");
- DatabaseBuilder config = new DatabaseConfig();
+ var config = new DatabaseConfig().settings();
config.loadFromProperties(props);
String ddlInitSql = config.getDdlInitSql();
@@ -84,46 +84,47 @@ class DatabaseConfigTest {
config.loadFromProperties(props);
- assertFalse(config.isDefaultServer());
- assertTrue(config.isDisableL2Cache());
- assertTrue(config.isNotifyL2CacheInForeground());
- assertTrue(config.isDbOffline());
- assertTrue(config.isAutoReadOnlyDataSource());
- assertTrue(config.isAutoLoadModuleInfo());
- assertTrue(config.isLoadModuleInfo());
- assertTrue(config.skipDataSourceCheck());
+ var settings = config.settings();
+ assertFalse(settings.isDefaultServer());
+ assertTrue(settings.isDisableL2Cache());
+ assertTrue(settings.isNotifyL2CacheInForeground());
+ assertTrue(settings.isDbOffline());
+ assertTrue(settings.isAutoReadOnlyDataSource());
+ assertTrue(settings.isAutoLoadModuleInfo());
+ assertTrue(settings.isLoadModuleInfo());
+ assertTrue(settings.skipDataSourceCheck());
- assertTrue(config.isIdGeneratorAutomatic());
- assertFalse(config.getPlatformConfig().isCaseSensitiveCollation());
- assertTrue(config.getPlatformConfig().isForUpdateNoKey());
+ assertTrue(settings.isIdGeneratorAutomatic());
+ assertFalse(settings.getPlatformConfig().isCaseSensitiveCollation());
+ assertTrue(settings.getPlatformConfig().isForUpdateNoKey());
- assertThat(config.getNamingConvention()).isInstanceOf(MatchingNamingConvention.class);
+ assertThat(settings.getNamingConvention()).isInstanceOf(MatchingNamingConvention.class);
- assertEquals(MutationDetection.NONE, config.getJsonMutationDetection());
+ assertEquals(MutationDetection.NONE, settings.getJsonMutationDetection());
config.setJsonMutationDetection(MutationDetection.SOURCE);
- assertEquals(MutationDetection.SOURCE, config.getJsonMutationDetection());
- assertEquals(IdType.SEQUENCE, config.getIdType());
- assertEquals(PersistBatch.ALL, config.getPersistBatch());
- assertEquals(PersistBatch.ALL, config.getPersistBatchOnCascade());
- Assertions.assertEquals(PlatformConfig.DbUuid.BINARY, config.getPlatformConfig().getDbUuid());
- Assertions.assertEquals(JsonConfig.DateTime.MILLIS, config.getJsonDateTime());
- assertEquals(JsonConfig.Date.MILLIS, config.getJsonDate());
+ assertEquals(MutationDetection.SOURCE, settings.getJsonMutationDetection());
+ assertEquals(IdType.SEQUENCE, settings.getIdType());
+ assertEquals(PersistBatch.ALL, settings.getPersistBatch());
+ assertEquals(PersistBatch.ALL, settings.getPersistBatchOnCascade());
+ Assertions.assertEquals(PlatformConfig.DbUuid.BINARY, settings.getPlatformConfig().getDbUuid());
+ Assertions.assertEquals(JsonConfig.DateTime.MILLIS, settings.getJsonDateTime());
+ assertEquals(JsonConfig.Date.MILLIS, settings.getJsonDate());
- assertEquals("r0,users,orgs", config.getEnabledL2Regions());
+ assertEquals("r0,users,orgs", settings.getEnabledL2Regions());
- assertEquals(42, config.getJdbcFetchSizeFindEach());
- assertEquals(43, config.getJdbcFetchSizeFindList());
- assertEquals(4, config.getBackgroundExecutorSchedulePoolSize());
- assertEquals(98, config.getBackgroundExecutorShutdownSecs());
+ assertEquals(42, settings.getJdbcFetchSizeFindEach());
+ assertEquals(43, settings.getJdbcFetchSizeFindList());
+ assertEquals(4, settings.getBackgroundExecutorSchedulePoolSize());
+ assertEquals(98, settings.getBackgroundExecutorShutdownSecs());
- assertTrue(config.isQueryPlanEnable());
- assertEquals(10000, config.getQueryPlanThresholdMicros());
- assertTrue(config.isQueryPlanCapture());
- assertEquals(42, config.getQueryPlanCapturePeriodSecs());
- assertEquals(560, config.getQueryPlanCaptureMaxTimeMillis());
- assertEquals(7, config.getQueryPlanCaptureMaxCount());
+ assertTrue(settings.isQueryPlanEnable());
+ assertEquals(10000, settings.getQueryPlanThresholdMicros());
+ assertTrue(settings.isQueryPlanCapture());
+ assertEquals(42, settings.getQueryPlanCapturePeriodSecs());
+ assertEquals(560, settings.getQueryPlanCaptureMaxTimeMillis());
+ assertEquals(7, settings.getQueryPlanCaptureMaxCount());
- assertThat(config.getMappingLocations()).containsExactly("classpath:/foo","bar");
+ assertThat(settings.getMappingLocations()).containsExactly("classpath:/foo","bar");
config.setPersistBatch(PersistBatch.NONE);
config.setPersistBatchOnCascade(PersistBatch.NONE);
@@ -138,19 +139,19 @@ class DatabaseConfigTest {
props1.setProperty("ebean.notifyL2CacheInForeground", "false");
config.loadFromProperties(props1);
- assertFalse(config.isDisableL2Cache());
- assertFalse(config.isNotifyL2CacheInForeground());
+ assertFalse(settings.isDisableL2Cache());
+ assertFalse(settings.isNotifyL2CacheInForeground());
- assertEquals(PersistBatch.ALL, config.getPersistBatch());
- assertEquals(PersistBatch.ALL, config.getPersistBatchOnCascade());
+ assertEquals(PersistBatch.ALL, settings.getPersistBatch());
+ assertEquals(PersistBatch.ALL, settings.getPersistBatchOnCascade());
config.setEnabledL2Regions("r0,orgs");
- assertEquals("r0,orgs", config.getEnabledL2Regions());
+ assertEquals("r0,orgs", settings.getEnabledL2Regions());
}
@Test
void test_defaults() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseBuilder.Settings config = new DatabaseConfig().settings();
assertTrue(config.isIdGeneratorAutomatic());
assertTrue(config.isDefaultServer());
assertFalse(config.isAutoPersistUpdates());
@@ -185,7 +186,7 @@ class DatabaseConfigTest {
void test_putServiceObject() {
ObjectMapper objectMapper = new ObjectMapper();
- DatabaseBuilder config = new DatabaseConfig();
+ var config = new DatabaseConfig().settings();
config.putServiceObject(objectMapper);
ObjectMapper mapper0 = config.getServiceObject(ObjectMapper.class);
diff --git a/ebean-bom/pom.xml b/ebean-bom/pom.xml
index 54e4b0a8e..f82651f6e 100644
--- a/ebean-bom/pom.xml
+++ b/ebean-bom/pom.xml
@@ -113,13 +113,13 @@
io.ebean
ebean-joda-time
- 13.24.0-RC1
+ 13.24.0-RC2
io.ebean
ebean-jackson-jsonnode
- 13.24.0-RC1
+ 13.24.0-RC2
diff --git a/ebean-core-type/src/main/java/io/ebean/core/type/ExtraTypeFactory.java b/ebean-core-type/src/main/java/io/ebean/core/type/ExtraTypeFactory.java
index e4da6fd7b..010f86fec 100644
--- a/ebean-core-type/src/main/java/io/ebean/core/type/ExtraTypeFactory.java
+++ b/ebean-core-type/src/main/java/io/ebean/core/type/ExtraTypeFactory.java
@@ -12,5 +12,5 @@ public interface ExtraTypeFactory {
/**
* Provide extra types to Ebean.
*/
- List extends ScalarType>> createTypes(DatabaseBuilder config, Object objectMapper);
+ List extends ScalarType>> createTypes(DatabaseBuilder.Settings config, Object objectMapper);
}
diff --git a/ebean-core-type/src/main/java/io/ebean/core/type/ScalarTypeSetFactory.java b/ebean-core-type/src/main/java/io/ebean/core/type/ScalarTypeSetFactory.java
index 89a6187d1..44ef36d72 100644
--- a/ebean-core-type/src/main/java/io/ebean/core/type/ScalarTypeSetFactory.java
+++ b/ebean-core-type/src/main/java/io/ebean/core/type/ScalarTypeSetFactory.java
@@ -12,6 +12,6 @@ public interface ScalarTypeSetFactory {
* Create the ScalarTypeSet given the config and optional objectMapper.
*/
@Nullable
- ScalarTypeSet> createTypeSet(DatabaseBuilder config, @Nullable Object objectMapper);
+ ScalarTypeSet> createTypeSet(DatabaseBuilder.Settings config, @Nullable Object objectMapper);
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/api/GeoTypeProvider.java b/ebean-core/src/main/java/io/ebeaninternal/api/GeoTypeProvider.java
index e9dcd6ebe..59566e437 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/api/GeoTypeProvider.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/api/GeoTypeProvider.java
@@ -11,5 +11,5 @@ public interface GeoTypeProvider {
/**
* Create a binder for binding geometry types.
*/
- GeoTypeBinder createBinder(DatabaseBuilder config);
+ GeoTypeBinder createBinder(DatabaseBuilder.Settings config);
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/cache/CacheManagerOptions.java b/ebean-core/src/main/java/io/ebeaninternal/server/cache/CacheManagerOptions.java
index e3af6137c..deda681e2 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/cache/CacheManagerOptions.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/cache/CacheManagerOptions.java
@@ -13,7 +13,7 @@ import io.ebeaninternal.server.cluster.ClusterManager;
public final class CacheManagerOptions {
private final ClusterManager clusterManager;
- private final DatabaseBuilder databaseBuilder;
+ private final DatabaseBuilder.Settings databaseBuilder;
private final boolean localL2Caching;
private CurrentTenantProvider currentTenantProvider;
private QueryCacheEntryValidate queryCacheEntryValidate;
@@ -30,7 +30,7 @@ public final class CacheManagerOptions {
this.queryDefault = new ServerCacheOptions();
}
- public CacheManagerOptions(ClusterManager clusterManager, DatabaseBuilder config, boolean localL2Caching) {
+ public CacheManagerOptions(ClusterManager clusterManager, DatabaseBuilder.Settings config, boolean localL2Caching) {
this.clusterManager = clusterManager;
this.databaseBuilder = config;
this.localL2Caching = localL2Caching;
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/ClassPathScanners.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/ClassPathScanners.java
index 18b6a1d5b..d62dbde8c 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/ClassPathScanners.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/ClassPathScanners.java
@@ -16,7 +16,7 @@ public class ClassPathScanners {
/**
* Return the list of ClassPathScanner services using DatabaseConfig service loader.
*/
- public static List find(DatabaseBuilder config) {
+ public static List find(DatabaseBuilder.Settings config) {
List scanners = new ArrayList<>();
for (ClassPathScannerFactory factory : ServiceLoader.load(ClassPathScannerFactory.class)) {
scanners.add(factory.createScanner(config.getClassLoadConfig().getClassLoader()));
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/DatabasePlatformFactory.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/DatabasePlatformFactory.java
index 016722848..20a693e6e 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/DatabasePlatformFactory.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/DatabasePlatformFactory.java
@@ -37,7 +37,7 @@ public class DatabasePlatformFactory {
/**
* Create the appropriate database specific platform.
*/
- public DatabasePlatform create(DatabaseBuilder config) {
+ public DatabasePlatform create(DatabaseBuilder.Settings config) {
try {
String offlinePlatform = DbOffline.getPlatform();
if (offlinePlatform != null) {
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultContainer.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultContainer.java
index 3cd1c4713..70cb3ce52 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultContainer.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultContainer.java
@@ -58,7 +58,8 @@ public final class DefaultContainer implements SpiContainer {
return createServer(config);
}
- private SpiBackgroundExecutor createBackgroundExecutor(DatabaseBuilder config) {
+ private SpiBackgroundExecutor createBackgroundExecutor(DatabaseBuilder builder) {
+ var config = builder.settings();
String namePrefix = "ebean-" + config.getName();
int schedulePoolSize = config.getBackgroundExecutorSchedulePoolSize();
int shutdownSecs = config.getBackgroundExecutorShutdownSecs();
@@ -70,9 +71,10 @@ public final class DefaultContainer implements SpiContainer {
* Create the implementation from the configuration.
*/
@Override
- public SpiEbeanServer createServer(DatabaseBuilder config) {
+ public SpiEbeanServer createServer(DatabaseBuilder builder) {
lock.lock();
try {
+ var config = builder.settings();
long start = System.currentTimeMillis();
applyConfigServices(config);
setNamingConvention(config);
@@ -116,7 +118,7 @@ public final class DefaultContainer implements SpiContainer {
}
}
- private void applyConfigServices(DatabaseBuilder config) {
+ private void applyConfigServices(DatabaseBuilder.Settings config) {
if (config.isDefaultServer()) {
for (DatabaseConfigProvider configProvider : ServiceLoader.load(DatabaseConfigProvider.class)) {
configProvider.apply(config);
@@ -159,7 +161,7 @@ public final class DefaultContainer implements SpiContainer {
* Get the entities, scalarTypes, Listeners etc combining the class registered
* ones with the already created instances.
*/
- private BootupClasses bootupClasses(DatabaseBuilder config) {
+ private BootupClasses bootupClasses(DatabaseBuilder.Settings config) {
BootupClasses bootup = bootupClasses1(config);
bootup.addServerConfigStartup(config.getServerConfigStartupListeners());
bootup.runServerConfigStartup(config);
@@ -177,7 +179,7 @@ public final class DefaultContainer implements SpiContainer {
/**
* Get the class based entities, scalarTypes, Listeners etc.
*/
- private BootupClasses bootupClasses1(DatabaseBuilder config) {
+ private BootupClasses bootupClasses1(DatabaseBuilder.Settings config) {
Set> classes = config.classes();
if (config.isDisableClasspathSearch() || (classes != null && !classes.isEmpty())) {
// use classes we explicitly added via configuration
@@ -189,7 +191,7 @@ public final class DefaultContainer implements SpiContainer {
/**
* Set the naming convention to underscore if it has not already been set.
*/
- private void setNamingConvention(DatabaseBuilder config) {
+ private void setNamingConvention(DatabaseBuilder.Settings config) {
if (config.getNamingConvention() == null) {
config.setNamingConvention(new UnderscoreNamingConvention());
}
@@ -198,7 +200,7 @@ public final class DefaultContainer implements SpiContainer {
/**
* Set the DatabasePlatform if it has not already been set.
*/
- private void setDatabasePlatform(DatabaseBuilder config) {
+ private void setDatabasePlatform(DatabaseBuilder.Settings config) {
DatabasePlatform platform = config.getDatabasePlatform();
if (platform == null) {
if (config.getTenantMode().isDynamicDataSource()) {
@@ -214,7 +216,7 @@ public final class DefaultContainer implements SpiContainer {
/**
* Set the DataSource if it has not already been set.
*/
- private void setDataSource(DatabaseBuilder config) {
+ private void setDataSource(DatabaseBuilder.Settings config) {
if (isOfflineMode(config)) {
log.log(DEBUG, "... DbOffline using platform [{0}]", DbOffline.getPlatform());
} else {
@@ -222,7 +224,7 @@ public final class DefaultContainer implements SpiContainer {
}
}
- private boolean isOfflineMode(DatabaseBuilder config) {
+ private boolean isOfflineMode(DatabaseBuilder.Settings config) {
return config.isDbOffline() || DbOffline.isSet();
}
@@ -236,7 +238,7 @@ public final class DefaultContainer implements SpiContainer {
* checking may not work as expected.
*
*/
- private boolean checkDataSource(DatabaseBuilder config) {
+ private boolean checkDataSource(DatabaseBuilder.Settings config) {
if (isOfflineMode(config)) {
return false;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java
index b9927be90..3327cd133 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/DefaultServer.java
@@ -76,7 +76,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
private static final System.Logger log = CoreLog.internal;
private final ReentrantLock lock = new ReentrantLock();
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
private final String serverName;
private final DatabasePlatform databasePlatform;
private final TransactionManager transactionManager;
@@ -170,7 +170,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
/**
* Create the CallStackFactory depending if AutoTune is being used.
*/
- private CallOriginFactory initCallStackFactory(DatabaseBuilder config) {
+ private CallOriginFactory initCallStackFactory(DatabaseBuilder.Settings config) {
if (!config.getAutoTuneConfig().isActive()) {
// use a common CallStack for performance as we don't care with no AutoTune
return new NoopCallOriginFactory();
@@ -224,7 +224,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
- public DatabaseBuilder config() {
+ public DatabaseBuilder.Settings config() {
return config;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java
index 631c0b7d8..b40b740e9 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/InitDataSource.java
@@ -12,16 +12,16 @@ import javax.sql.DataSource;
*/
final class InitDataSource {
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
/**
* Create and set the main DataSource and read-only DataSource.
*/
- static void init(DatabaseBuilder config) {
+ static void init(DatabaseBuilder.Settings config) {
new InitDataSource(config).initialise();
}
- InitDataSource(DatabaseBuilder config) {
+ InitDataSource(DatabaseBuilder.Settings config) {
this.config = config;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/InternalConfiguration.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/InternalConfiguration.java
index cf49f1637..9e2dbbfdc 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/InternalConfiguration.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/InternalConfiguration.java
@@ -69,7 +69,7 @@ public final class InternalConfiguration {
private final TableModState tableModState;
private final boolean online;
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
private final BootupClasses bootupClasses;
private final DatabasePlatform databasePlatform;
private final DeployInherit deployInherit;
@@ -98,12 +98,12 @@ public final class InternalConfiguration {
private boolean localL2Caching;
InternalConfiguration(boolean online, ClusterManager clusterManager, SpiBackgroundExecutor backgroundExecutor,
- DatabaseBuilder config, BootupClasses bootupClasses) {
+ DatabaseBuilder.Settings config, BootupClasses bootupClasses) {
this.online = online;
this.config = config;
this.jacksonCorePresent = config.getClassLoadConfig().isJacksonCorePresent();
- this.clockService = new ClockService(config.getClock());
+ this.clockService = new ClockService(config.settings().getClock());
this.tableModState = new TableModState();
this.logManager = initLogManager();
this.docStoreFactory = initDocStoreFactory(service(DocStoreFactory.class));
@@ -173,7 +173,7 @@ public final class InternalConfiguration {
/**
* Create and return the ExpressionFactory based on configuration and database platform.
*/
- private ExpressionFactory initExpressionFactory(DatabaseBuilder config) {
+ private ExpressionFactory initExpressionFactory(DatabaseBuilder.Settings config) {
boolean nativeIlike = config.isExpressionNativeIlike() && databasePlatform.supportsNativeIlike();
return new DefaultExpressionFactory(config.isExpressionEqualsWithNullAsNoop(), nativeIlike);
}
@@ -331,7 +331,7 @@ public final class InternalConfiguration {
return config.getDatabasePlatform();
}
- public DatabaseBuilder getConfig() {
+ public DatabaseBuilder.Settings getConfig() {
return config;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClassPathSearch.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClassPathSearch.java
index 7d0b43c5f..0db785d1c 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClassPathSearch.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClassPathSearch.java
@@ -24,11 +24,11 @@ public class BootupClassPathSearch {
* Search the classPath for the classes we are interested in returning
* them as BootupClasses.
*/
- public static BootupClasses search(DatabaseBuilder config) {
+ public static BootupClasses search(DatabaseBuilder.Settings config) {
return new BootupClassPathSearch(config).getBootupClasses();
}
- private BootupClassPathSearch(DatabaseBuilder config) {
+ private BootupClassPathSearch(DatabaseBuilder.Settings config) {
// find packages defined in ebean.mf resources
Set mfPackages = ManifestReader.create(config.getClassLoadConfig().getClassLoader())
.read("META-INF/ebean.mf")
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java b/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java
index 0a01cfa4a..726411dd2 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/core/bootup/BootupClasses.java
@@ -172,7 +172,7 @@ public class BootupClasses implements Predicate> {
add(startupInstances, serverConfigStartupInstances, serverConfigStartupCandidates);
}
- public void addChangeLogInstances(DatabaseBuilder config) {
+ public void addChangeLogInstances(DatabaseBuilder.Settings config) {
readAuditPrepare = config.getReadAuditPrepare();
readAuditLogger = config.getReadAuditLogger();
changeLogPrepare = config.getChangeLogPrepare();
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java
index 9efe9f306..06930f128 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptor.java
@@ -423,7 +423,7 @@ public class BeanDescriptor implements BeanType, STreeType, SpiBeanType {
/**
* Return the DatabaseConfig.
*/
- public DatabaseBuilder config() {
+ public DatabaseBuilder.Settings config() {
return owner.config();
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorManager.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorManager.java
index ec0aca791..240ab41a2 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorManager.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorManager.java
@@ -79,7 +79,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
private final NamingConvention namingConvention;
private final DeployCreateProperties createProperties;
private final BeanManagerFactory beanManagerFactory;
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
private final ChangeLogListener changeLogListener;
private final ChangeLogRegister changeLogRegister;
private final ChangeLogPrepare changeLogPrepare;
@@ -196,19 +196,19 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
/**
* Return the AsOfViewSuffix based on the DbHistorySupport.
*/
- private String asOfViewSuffix(DatabasePlatform databasePlatform, DatabaseBuilder serverConfig) {
+ private String asOfViewSuffix(DatabasePlatform databasePlatform, DatabaseBuilder.Settings config) {
DbHistorySupport historySupport = databasePlatform.historySupport();
// with historySupport returns a simple view suffix or the sql2011 as of timestamp suffix
- return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getAsOfViewSuffix(serverConfig.getAsOfViewSuffix());
+ return (historySupport == null) ? config.getAsOfViewSuffix() : historySupport.getAsOfViewSuffix(config.getAsOfViewSuffix());
}
/**
* Return the versions between timestamp suffix based on the DbHistorySupport.
*/
- private String versionsBetweenSuffix(DatabasePlatform databasePlatform, DatabaseBuilder serverConfig) {
+ private String versionsBetweenSuffix(DatabasePlatform databasePlatform, DatabaseBuilder.Settings config) {
DbHistorySupport historySupport = databasePlatform.historySupport();
// with historySupport returns a simple view suffix or the sql2011 versions between timestamp suffix
- return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getVersionsBetweenSuffix(serverConfig.getAsOfViewSuffix());
+ return (historySupport == null) ? config.getAsOfViewSuffix() : historySupport.getVersionsBetweenSuffix(config.getAsOfViewSuffix());
}
@Override
@@ -217,7 +217,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
@Override
- public DatabaseBuilder config() {
+ public DatabaseBuilder.Settings config() {
return config;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorMap.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorMap.java
index 5aa2d0166..e95cf2f12 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorMap.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanDescriptorMap.java
@@ -25,7 +25,7 @@ public interface BeanDescriptorMap {
/**
* Return the DatabaseConfig.
*/
- DatabaseBuilder config();
+ DatabaseBuilder.Settings config();
/**
* Return the Cache Manager.
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java
index 4de9279b3..4eeff5f4a 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java
@@ -34,7 +34,7 @@ final class BeanLifecycleAdapterFactory {
private final boolean postConstructPresent;
- BeanLifecycleAdapterFactory(DatabaseBuilder config) {
+ BeanLifecycleAdapterFactory(DatabaseBuilder.Settings config) {
this.postConstructPresent = config.getClassLoadConfig().isJavaxPostConstructPresent();
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/GeneratedPropertyFactory.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/GeneratedPropertyFactory.java
index b920054cf..ff4b40a56 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/GeneratedPropertyFactory.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/generatedproperty/GeneratedPropertyFactory.java
@@ -27,7 +27,7 @@ public final class GeneratedPropertyFactory {
private final ClassLoadConfig classLoadConfig;
private final Map idGeneratorMap = new HashMap<>();
- public GeneratedPropertyFactory(boolean offlineMode, DatabaseBuilder config, List idGenerators) {
+ public GeneratedPropertyFactory(boolean offlineMode, DatabaseBuilder.Settings config, List idGenerators) {
this.classLoadConfig = config.getClassLoadConfig();
this.insertFactory = new InsertTimestampFactory(classLoadConfig);
this.updateFactory = new UpdateTimestampFactory(classLoadConfig);
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java
index ecc455152..1f56614d1 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/meta/DeployBeanDescriptor.java
@@ -47,7 +47,7 @@ public class DeployBeanDescriptor {
private static final PropOrder PROP_ORDER = new PropOrder();
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
private final BeanDescriptorManager manager;
/**
* Map of BeanProperty Linked so as to preserve order.
@@ -133,7 +133,7 @@ public class DeployBeanDescriptor {
/**
* Construct the BeanDescriptor.
*/
- public DeployBeanDescriptor(BeanDescriptorManager manager, Class beanType, DatabaseBuilder config) {
+ public DeployBeanDescriptor(BeanDescriptorManager manager, Class beanType, DatabaseBuilder.Settings config) {
this.manager = manager;
this.config = config;
this.beanType = beanType;
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java
index d728344f0..8da22e0c4 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/DeployUtil.java
@@ -44,7 +44,7 @@ public final class DeployUtil {
private final Encryptor bytesEncryptor;
private final boolean useValidationNotNull;
- public DeployUtil(TypeManager typeMgr, DatabaseBuilder config) {
+ public DeployUtil(TypeManager typeMgr, DatabaseBuilder.Settings config) {
this.typeManager = typeMgr;
this.namingConvention = config.getNamingConvention();
this.dbPlatform = config.getDatabasePlatform();
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotationConfig.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotationConfig.java
index 2fd6d1e78..74268616b 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotationConfig.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotationConfig.java
@@ -31,7 +31,7 @@ final class ReadAnnotationConfig {
private final ReadValidationAnnotations jakartaValidation;
private final Set> metaAnnotations = new HashSet<>();
- ReadAnnotationConfig(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseBuilder config) {
+ ReadAnnotationConfig(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseBuilder.Settings config) {
this.generatedPropFactory = generatedPropFactory;
this.asOfViewSuffix = asOfViewSuffix;
this.versionsBetweenSuffix = versionsBetweenSuffix;
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotations.java b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotations.java
index 5bb7ae54d..162d4cbb2 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotations.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/deploy/parse/ReadAnnotations.java
@@ -12,7 +12,7 @@ public final class ReadAnnotations {
private final ReadAnnotationConfig readConfig;
- public ReadAnnotations(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseBuilder config) {
+ public ReadAnnotations(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseBuilder.Settings config) {
this.readConfig = new ReadAnnotationConfig(generatedPropFactory, asOfViewSuffix, versionsBetweenSuffix, config);
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java
index 73a1d9a2d..969d7ca25 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/CQueryEngine.java
@@ -38,7 +38,7 @@ public final class CQueryEngine {
private final CQueryHistorySupport historySupport;
private final DatabasePlatform dbPlatform;
- public CQueryEngine(DatabaseBuilder config, DatabasePlatform dbPlatform, Binder binder, Map asOfTableMapping, Map draftTableMap) {
+ public CQueryEngine(DatabaseBuilder.Settings config, DatabasePlatform dbPlatform, Binder binder, Map asOfTableMapping, Map draftTableMap) {
this.dbPlatform = dbPlatform;
this.defaultFetchSizeFindEach = config.getJdbcFetchSizeFindEach();
this.defaultFetchSizeFindList = config.getJdbcFetchSizeFindList();
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManagerOptions.java b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManagerOptions.java
index f94bbd345..ba6dc3967 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManagerOptions.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/transaction/TransactionManagerOptions.java
@@ -18,7 +18,7 @@ public final class TransactionManagerOptions {
final SpiServer server;
final boolean notifyL2CacheInForeground;
- final DatabaseBuilder config;
+ final DatabaseBuilder.Settings config;
final ClusterManager clusterManager;
final BackgroundExecutor backgroundExecutor;
@@ -33,8 +33,8 @@ public final class TransactionManagerOptions {
final ClockService clockService;
- public TransactionManagerOptions(SpiServer server, boolean notifyL2CacheInForeground, DatabaseBuilder config, TransactionScopeManager scopeManager, ClusterManager clusterManager,
- BackgroundExecutor backgroundExecutor, DocStoreUpdateProcessor docStoreUpdateProcessor,
+ public TransactionManagerOptions(SpiServer server, boolean notifyL2CacheInForeground, DatabaseBuilder.Settings config, TransactionScopeManager scopeManager,
+ ClusterManager clusterManager, BackgroundExecutor backgroundExecutor, DocStoreUpdateProcessor docStoreUpdateProcessor,
BeanDescriptorManager descMgr, DataSourceSupplier dataSourceSupplier, SpiProfileHandler profileHandler,
SpiLogManager logManager, TableModState tableModState, ServerCacheNotify cacheNotify, ClockService clockService) {
this.server = server;
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeFactory.java b/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeFactory.java
index 881021efe..5b6e36be4 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeFactory.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeFactory.java
@@ -16,9 +16,9 @@ import java.util.Date;
*/
final class DefaultTypeFactory {
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
- public DefaultTypeFactory(DatabaseBuilder config) {
+ public DefaultTypeFactory(DatabaseBuilder.Settings config) {
this.config = config;
}
diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java b/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java
index 4cc68f665..d781b2abc 100644
--- a/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java
+++ b/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java
@@ -76,7 +76,7 @@ public final class DefaultTypeManager implements TypeManager {
/**
* Create the DefaultTypeManager.
*/
- public DefaultTypeManager(DatabaseBuilder config, BootupClasses bootupClasses) {
+ public DefaultTypeManager(DatabaseBuilder.Settings config, BootupClasses bootupClasses) {
this.jsonDateTime = config.getJsonDateTime();
this.jsonDate = config.getJsonDate();
this.typeMap = new ConcurrentHashMap<>();
@@ -108,7 +108,7 @@ public final class DefaultTypeManager implements TypeManager {
}
}
- private void loadGeoTypeBinder(DatabaseBuilder config) {
+ private void loadGeoTypeBinder(DatabaseBuilder.Settings config) {
GeoTypeProvider provider = config.getServiceObject(GeoTypeProvider.class);
if (provider == null) {
provider = ServiceUtil.service(GeoTypeProvider.class);
@@ -139,7 +139,7 @@ public final class DefaultTypeManager implements TypeManager {
/**
* Load custom scalar types registered via ExtraTypeFactory and ServiceLoader.
*/
- private void loadTypesFromProviders(DatabaseBuilder config, Object objectMapper) {
+ private void loadTypesFromProviders(DatabaseBuilder.Settings config, Object objectMapper) {
for (ExtraTypeFactory plugin : ServiceLoader.load(ExtraTypeFactory.class)) {
for (ScalarType> type : plugin.createTypes(config, objectMapper)) {
add(type);
@@ -616,7 +616,7 @@ public final class DefaultTypeManager implements TypeManager {
}
- private Object initObjectMapper(DatabaseBuilder config) {
+ private Object initObjectMapper(DatabaseBuilder.Settings config) {
Object objectMapper = config.getObjectMapper();
if (objectMapper == null) {
objectMapper = InitObjectMapper.init();
@@ -674,7 +674,7 @@ public final class DefaultTypeManager implements TypeManager {
}
- private void initialiseJavaTimeTypes(DatabaseBuilder config) {
+ private void initialiseJavaTimeTypes(DatabaseBuilder.Settings config) {
ZoneId zoneId = zoneId(config);
typeMap.put(java.nio.file.Path.class, new ScalarTypePath());
@@ -702,7 +702,7 @@ public final class DefaultTypeManager implements TypeManager {
addType(Duration.class, (durationNanos) ? new ScalarTypeDurationWithNanos() : new ScalarTypeDuration());
}
- private ZoneId zoneId(DatabaseBuilder config) {
+ private ZoneId zoneId(DatabaseBuilder.Settings config) {
final String dataTimeZone = config.getDataTimeZone();
return (dataTimeZone == null) ? ZoneOffset.systemDefault() : TimeZone.getTimeZone(dataTimeZone).toZoneId();
}
@@ -716,7 +716,7 @@ public final class DefaultTypeManager implements TypeManager {
* Register all the standard types supported. This is the standard JDBC types
* plus some other common types such as java.util.Date and java.util.Calendar.
*/
- private void initialiseStandard(DatabaseBuilder config) {
+ private void initialiseStandard(DatabaseBuilder.Settings config) {
DatabasePlatform databasePlatform = config.getDatabasePlatform();
int platformClobType = databasePlatform.clobDbType();
int platformBlobType = databasePlatform.blobDbType();
diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java
index 1a3f620ea..824477d43 100644
--- a/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java
+++ b/ebean-core/src/test/java/io/ebeaninternal/server/core/InitDataSourceTest.java
@@ -19,12 +19,12 @@ import static org.junit.jupiter.api.Assertions.*;
public class InitDataSourceTest {
- private DatabaseBuilder newConfig(String readOnlyUrl) {
+ private DatabaseBuilder.Settings newConfig(String readOnlyUrl) {
DatabaseBuilder config = new DatabaseConfig();
DataSourceConfig roConfig = new DataSourceConfig();
roConfig.setUrl(readOnlyUrl);
config.setReadOnlyDataSourceConfig(roConfig);
- return config;
+ return config.settings();
}
@Test
@@ -35,7 +35,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_null_whenSetNullExplicitly() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setReadOnlyDataSourceConfig(null);
assertNull(new InitDataSource(config).readOnlyConfig());
@@ -57,7 +57,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_autoReadOnlyDataSource() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setAutoReadOnlyDataSource(true);
assertNotNull(new InitDataSource(config).readOnlyConfig());
@@ -65,7 +65,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_autoReadOnlyDataSource_expect_setToNull() {
- DatabaseBuilder config = newConfig("none");
+ var config = newConfig("none");
config.setAutoReadOnlyDataSource(true);
final DataSourceBuilder readOnlyConfig = new InitDataSource(config).readOnlyConfig();
@@ -75,7 +75,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_urlSet() {
- DatabaseBuilder config = newConfig("foo");
+ var config = newConfig("foo");
final DataSourceBuilder roConfig = new InitDataSource(config).readOnlyConfig();
assertNotNull(roConfig);
@@ -84,7 +84,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_readOnlyUrlSetOnMain() {
- DatabaseBuilder config = newConfig(null);
+ var config = newConfig(null);
// alternate location to set read-only url for developer convenience
config.getDataSourceConfig().readOnlyUrl("bar");
@@ -95,7 +95,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_readOnlyUrlSetOnMain_withNone() {
- DatabaseBuilder config = newConfig("None");
+ var config = newConfig("None");
// alternate location to set read-only url for developer convenience
config.getDataSourceConfig().readOnlyUrl("bar");
@@ -106,7 +106,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_bothReadOnlyUrlsSet() {
- DatabaseBuilder config = newConfig("one");
+ var config = newConfig("one");
config.getDataSourceConfig().readOnlyUrl("two");
final DataSourceBuilder roConfig = new InitDataSource(config).readOnlyConfig();
@@ -116,7 +116,7 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_readOnlyUrlSetOnMain_withNoneNone() {
- DatabaseBuilder config = newConfig("none");
+ var config = newConfig("none");
// alternate location to set read-only url for developer convenience
config.getDataSourceConfig().readOnlyUrl("none");
@@ -126,8 +126,8 @@ public class InitDataSourceTest {
@Test
public void readOnlyConfig_when_urlSet_2() {
- DatabaseBuilder config = new DatabaseConfig();
- config.getReadOnlyDataSourceConfig().url("foo");
+ DatabaseConfig config = new DatabaseConfig();
+ config.settings().getReadOnlyDataSourceConfig().url("foo");
final DataSourceBuilder roConfig = new InitDataSource(config).readOnlyConfig();
assertNotNull(roConfig);
@@ -136,7 +136,7 @@ public class InitDataSourceTest {
@Test
void isPostgresAllQuotedIdentifiers_true_when_postgres() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setAllQuotedIdentifiers(true);
config.setDatabasePlatform(new PostgresPlatform());
@@ -145,7 +145,7 @@ public class InitDataSourceTest {
@Test
void isPostgresAllQuotedIdentifiers_true_when_postgres9() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setAllQuotedIdentifiers(true);
config.setDatabasePlatform(new Postgres9Platform());
@@ -154,7 +154,7 @@ public class InitDataSourceTest {
@Test
void isPostgresAllQuotedIdentifiers_false() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setAllQuotedIdentifiers(false);
config.setDatabasePlatform(new PostgresPlatform());
@@ -163,7 +163,7 @@ public class InitDataSourceTest {
@Test
void isPostgresAllQuotedIdentifiers_false_when_notPostgres() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setAllQuotedIdentifiers(true);
config.setDatabasePlatform(new H2Platform());
@@ -172,7 +172,7 @@ public class InitDataSourceTest {
@Test
public void online() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.getDataSourceConfig().username("sa");
config.getDataSourceConfig().password("");
config.getDataSourceConfig().url("jdbc:h2:mem:dsTestOnline");
@@ -204,7 +204,7 @@ public class InitDataSourceTest {
@Test
public void offline() throws SQLException {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
DataSourceBuilder dsConfig = config.getDataSourceConfig();
dsConfig.username("sa");
dsConfig.password("");
diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/deploy/parse/AnnotationClassTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/deploy/parse/AnnotationClassTest.java
index 78a9e6b90..31ede238e 100644
--- a/ebean-core/src/test/java/io/ebeaninternal/server/deploy/parse/AnnotationClassTest.java
+++ b/ebean-core/src/test/java/io/ebeaninternal/server/deploy/parse/AnnotationClassTest.java
@@ -46,7 +46,7 @@ public class AnnotationClassTest {
}
@SuppressWarnings({"unchecked", "rawtypes"})
- private AnnotationClass createAnnotationClass(DatabaseBuilder config) {
+ private AnnotationClass createAnnotationClass(DatabaseBuilder.Settings config) {
DeployUtil deployUtil = new DeployUtil(new DefaultTypeManager(config, new BootupClasses()), config);
DeployBeanInfo deployBeanInfo = new DeployBeanInfo(deployUtil, new DeployBeanDescriptor<>(null, Customer.class, null));
@@ -54,9 +54,9 @@ public class AnnotationClassTest {
return new AnnotationClass(deployBeanInfo, readAnnotationConfig);
}
- private DatabaseBuilder sqlServerPlatform(boolean allQuotedIdentifiers) {
+ private DatabaseBuilder.Settings sqlServerPlatform(boolean allQuotedIdentifiers) {
SqlServer17Platform sqlServer17Platform = new SqlServer17Platform();
- DatabaseBuilder config = new DatabaseConfig();
+ var config = new DatabaseConfig().settings();
config.setDatabasePlatform(sqlServer17Platform);
config.setAllQuotedIdentifiers(allQuotedIdentifiers);
diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeFactoryTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeFactoryTest.java
index d5b83e7c8..07780136d 100644
--- a/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeFactoryTest.java
+++ b/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeFactoryTest.java
@@ -1,5 +1,6 @@
package io.ebeaninternal.server.type;
+import io.ebean.config.DatabaseConfig;
import io.ebean.core.type.ScalarType;
import org.junit.jupiter.api.Test;
@@ -10,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class DefaultTypeFactoryTest {
- DefaultTypeFactory defaultTypeFactory = new DefaultTypeFactory(null);
+ DefaultTypeFactory defaultTypeFactory = new DefaultTypeFactory(new DatabaseConfig());
@Test
public void testCreateBoolean() throws Exception {
diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeManagerTest.java b/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeManagerTest.java
index 68adea658..646275c95 100644
--- a/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeManagerTest.java
+++ b/ebean-core/src/test/java/io/ebeaninternal/server/type/DefaultTypeManagerTest.java
@@ -21,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class DefaultTypeManagerTest {
private DefaultTypeManager create() {
- DatabaseBuilder serverConfig = new DatabaseConfig();
+ var serverConfig = new DatabaseConfig();
serverConfig.setDatabasePlatform(new PostgresPlatform());
BootupClasses bootupClasses = new BootupClasses();
return new DefaultTypeManager(serverConfig, bootupClasses);
diff --git a/ebean-core/src/test/java/io/ebeaninternal/server/type/TestTypeManager.java b/ebean-core/src/test/java/io/ebeaninternal/server/type/TestTypeManager.java
index b6c1e0bf2..3aa50c69b 100644
--- a/ebean-core/src/test/java/io/ebeaninternal/server/type/TestTypeManager.java
+++ b/ebean-core/src/test/java/io/ebeaninternal/server/type/TestTypeManager.java
@@ -122,7 +122,7 @@ class TestTypeManager extends BaseTest {
}
private DefaultTypeManager createTypeManager() {
- DatabaseBuilder config = new DatabaseConfig();
+ var config = new DatabaseConfig();
config.setDatabasePlatform(new H2Platform());
BootupClasses bootupClasses = new BootupClasses();
@@ -132,7 +132,7 @@ class TestTypeManager extends BaseTest {
}
private DefaultTypeManager createTypeManagerDefaultEnumTypeString() {
- DatabaseBuilder config = new DatabaseConfig();
+ var config = new DatabaseConfig();
config.setDatabasePlatform(new H2Platform());
config.setDefaultEnumType(EnumType.STRING);
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DdlGenerator.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DdlGenerator.java
index bb2516e88..9fb81acf1 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DdlGenerator.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DdlGenerator.java
@@ -51,7 +51,7 @@ public class DdlGenerator implements SpiDdlGenerator {
public DdlGenerator(SpiEbeanServer server) {
this.server = server;
- final DatabaseBuilder config = server.config();
+ final var config = server.config();
this.jaxbPresent = Detect.isJAXBPresent(config);
this.generateDdl = config.isDdlGenerate();
this.extraDdl = config.isDdlExtra();
@@ -318,7 +318,7 @@ public class DdlGenerator implements SpiDdlGenerator {
/**
* Create the ScriptTransform for placeholder key/value replacement.
*/
- private ScriptTransform createScriptTransform(DatabaseBuilder config) {
+ private ScriptTransform createScriptTransform(DatabaseBuilder.Settings config) {
return ScriptTransform.build(config.getDdlPlaceholders(), config.getDdlPlaceholderMap());
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DefaultDbMigration.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DefaultDbMigration.java
index 376aaa748..c44c6da5f 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DefaultDbMigration.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/DefaultDbMigration.java
@@ -73,7 +73,7 @@ public class DefaultDbMigration implements DbMigration {
protected DatabasePlatform databasePlatform;
private boolean vanillaPlatform;
protected List platforms = new ArrayList<>();
- protected DatabaseBuilder databaseBuilder;
+ protected DatabaseBuilder.Settings databaseBuilder;
protected DbConstraintNaming constraintNaming;
protected Boolean strictMode;
protected Boolean includeGeneratedFileComment;
@@ -114,7 +114,8 @@ public class DefaultDbMigration implements DbMigration {
}
@Override
- public void setServerConfig(DatabaseBuilder config) {
+ public void setServerConfig(DatabaseBuilder builder) {
+ var config = builder.settings();
if (this.databaseBuilder == null) {
this.databaseBuilder = config;
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/Detect.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/Detect.java
index 0f54abe15..7da655e23 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/Detect.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/Detect.java
@@ -10,7 +10,7 @@ public class Detect {
/**
* Return true if JAXB is present.
*/
- public static boolean isJAXBPresent(DatabaseBuilder config) {
+ public static boolean isJAXBPresent(DatabaseBuilder.Settings config) {
return config.getClassLoadConfig().isPresent("jakarta.xml.bind.JAXBException");
}
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandler.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandler.java
index 618b5c56f..1b5404465 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandler.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandler.java
@@ -14,7 +14,7 @@ public class BaseDdlHandler implements DdlHandler {
protected final TableDdl tableDdl;
- public BaseDdlHandler(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public BaseDdlHandler(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
this(config, platformDdl, new BaseTableDdl(config, platformDdl));
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdl.java
index 4ad068e34..07b6b0ade 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdl.java
@@ -155,7 +155,7 @@ public class BaseTableDdl implements TableDdl {
/**
* Construct with a naming convention and platform specific DDL.
*/
- public BaseTableDdl(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public BaseTableDdl(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
this.namingConvention = config.getNamingConvention();
this.naming = config.getConstraintNaming();
this.historyTableSuffix = config.getHistoryTableSuffix();
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdl.java
index d39f810d9..91a4d43bc 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdl.java
@@ -18,7 +18,7 @@ public class ClickHouseDdl extends PlatformDdl {
}
@Override
- public DdlHandler createDdlHandler(DatabaseBuilder config) {
+ public DdlHandler createDdlHandler(DatabaseBuilder.Settings config) {
return new ClickHouseDdlHandler(config, this);
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdlHandler.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdlHandler.java
index 813b17828..9d7bca961 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdlHandler.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseDdlHandler.java
@@ -5,7 +5,7 @@ import io.ebeaninternal.dbmigration.ddlgeneration.BaseDdlHandler;
public class ClickHouseDdlHandler extends BaseDdlHandler {
- public ClickHouseDdlHandler(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public ClickHouseDdlHandler(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
super(config, platformDdl, new ClickHouseTableDdl(config, platformDdl));
}
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseTableDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseTableDdl.java
index 106c2626a..d3fcb2331 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseTableDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/ClickHouseTableDdl.java
@@ -6,7 +6,7 @@ import io.ebeaninternal.dbmigration.migration.CreateTable;
public class ClickHouseTableDdl extends BaseTableDdl {
- public ClickHouseTableDdl(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public ClickHouseTableDdl(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
super(config, platformDdl);
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/Db2HistoryDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/Db2HistoryDdl.java
index b005278ad..e03c4f3c1 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/Db2HistoryDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/Db2HistoryDdl.java
@@ -20,7 +20,7 @@ public class Db2HistoryDdl extends DbTableBasedHistoryDdl implements PlatformHis
private String transactionId;
@Override
- public void configure(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
super.configure(config, platformDdl);
this.systemPeriodStart = config.getAsOfSysPeriod() + "_start";
this.systemPeriodEnd = config.getAsOfSysPeriod() + "_end";
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTableBasedHistoryDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTableBasedHistoryDdl.java
index 6c584878e..2113319a9 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTableBasedHistoryDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTableBasedHistoryDdl.java
@@ -16,7 +16,7 @@ public abstract class DbTableBasedHistoryDdl implements PlatformHistoryDdl.Table
protected PlatformDdl platformDdl;
@Override
- public void configure(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
this.platformDdl = platformDdl;
this.historySuffix = config.getHistoryTableSuffix();
this.constraintNaming = config.getConstraintNaming();
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTriggerBasedHistoryDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTriggerBasedHistoryDdl.java
index eb85459a8..ab441a3f5 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTriggerBasedHistoryDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/DbTriggerBasedHistoryDdl.java
@@ -28,7 +28,7 @@ public abstract class DbTriggerBasedHistoryDdl extends DbTableBasedHistoryDdl im
}
@Override
- public void configure(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
super.configure(config, platformDdl);
this.sysPeriod = config.getAsOfSysPeriod();
this.viewSuffix = config.getAsOfViewSuffix();
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/HanaHistoryDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/HanaHistoryDdl.java
index 38daedab2..8bf4284ba 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/HanaHistoryDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/HanaHistoryDdl.java
@@ -17,7 +17,7 @@ public class HanaHistoryDdl extends DbTableBasedHistoryDdl implements PlatformHi
private String systemPeriodEnd;
@Override
- public void configure(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
super.configure(config, platformDdl);
this.systemPeriodStart = config.getAsOfSysPeriod() + "_start";
this.systemPeriodEnd = config.getAsOfSysPeriod() + "_end";
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/MariaDbHistoryDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/MariaDbHistoryDdl.java
index 1faffeb64..6e65330b6 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/MariaDbHistoryDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/MariaDbHistoryDdl.java
@@ -16,7 +16,7 @@ public class MariaDbHistoryDdl implements PlatformHistoryDdl {
private PlatformDdl platformDdl;
@Override
- public void configure(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
this.platformDdl = platformDdl;
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/NoHistorySupportDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/NoHistorySupportDdl.java
index 10d08718f..8400af8dc 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/NoHistorySupportDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/NoHistorySupportDdl.java
@@ -13,7 +13,7 @@ import io.ebeaninternal.dbmigration.model.MTable;
public class NoHistorySupportDdl implements PlatformHistoryDdl {
@Override
- public void configure(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
// does nothing
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java
index 9efc25123..a11d2a12e 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java
@@ -105,7 +105,7 @@ public class PlatformDdl {
/**
* Set configuration options.
*/
- public void configure(DatabaseBuilder config) {
+ public void configure(DatabaseBuilder.Settings config) {
historyDdl.configure(config, this);
naming = config.getConstraintNaming();
}
@@ -113,7 +113,7 @@ public class PlatformDdl {
/**
* Create a DdlHandler for the specific database platform.
*/
- public DdlHandler createDdlHandler(DatabaseBuilder config) {
+ public DdlHandler createDdlHandler(DatabaseBuilder.Settings config) {
return new BaseDdlHandler(config, this);
}
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformHistoryDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformHistoryDdl.java
index 41f62ec76..a07224342 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformHistoryDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformHistoryDdl.java
@@ -14,7 +14,7 @@ public interface PlatformHistoryDdl {
/**
* Configure typically reading the necessary parameters from DatabaseConfig and Platform.
*/
- void configure(DatabaseBuilder config, PlatformDdl platformDdl);
+ void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl);
/**
* Creates a new table and add history support to the table using platform specific mechanism.
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/SqlServerHistoryDdl.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/SqlServerHistoryDdl.java
index a0b1519cb..88eb895e6 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/SqlServerHistoryDdl.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/SqlServerHistoryDdl.java
@@ -22,7 +22,7 @@ public class SqlServerHistoryDdl implements PlatformHistoryDdl {
protected String historySuffix;
@Override
- public void configure(DatabaseBuilder config, PlatformDdl platformDdl) {
+ public void configure(DatabaseBuilder.Settings config, PlatformDdl platformDdl) {
this.systemPeriodStart = config.getAsOfSysPeriod() + "From";
this.systemPeriodEnd = config.getAsOfSysPeriod() + "To";
this.platformDdl = platformDdl;
diff --git a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/PlatformDdlWriter.java b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/PlatformDdlWriter.java
index c0938701a..02b90c9a2 100644
--- a/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/PlatformDdlWriter.java
+++ b/ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/model/PlatformDdlWriter.java
@@ -26,13 +26,13 @@ public class PlatformDdlWriter {
private static final System.Logger logger = AppLog.getLogger(PlatformDdlWriter.class);
- private final DatabaseBuilder databaseBuilder;
+ private final DatabaseBuilder.Settings config;
private final PlatformDdl platformDdl;
private final int lockTimeoutSeconds;
- public PlatformDdlWriter(DatabasePlatform platform, DatabaseBuilder dbConfig, int lockTimeoutSeconds) {
+ public PlatformDdlWriter(DatabasePlatform platform, DatabaseBuilder.Settings config, int lockTimeoutSeconds) {
this.platformDdl = PlatformDdlBuilder.create(platform);
- this.databaseBuilder = dbConfig;
+ this.config = config;
this.lockTimeoutSeconds = lockTimeoutSeconds;
}
@@ -87,7 +87,7 @@ public class PlatformDdlWriter {
* Write the 'Apply' DDL buffers to the writer.
*/
protected void writeApplyDdl(Writer writer, DdlWrite ddl) throws IOException {
- String header = databaseBuilder.getDdlHeader();
+ String header = config.getDdlHeader();
if (header != null && !header.isEmpty()) {
writer.append(header).append('\n');
}
@@ -98,7 +98,7 @@ public class PlatformDdlWriter {
* Return the platform specific DdlHandler (to generate DDL).
*/
protected DdlHandler handler() {
- return platformDdl.createDdlHandler(databaseBuilder);
+ return platformDdl.createDdlHandler(config);
}
/**
diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandlerTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandlerTest.java
index d90b1d14e..7266ed90c 100644
--- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandlerTest.java
+++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/BaseDdlHandlerTest.java
@@ -22,7 +22,7 @@ public class BaseDdlHandlerTest extends BaseTestCase {
private static boolean useV1Syntax = Boolean.getBoolean("ebean.h2.useV1Syntax");
- private final DatabaseBuilder serverConfig = new DatabaseConfig();
+ private final DatabaseConfig serverConfig = new DatabaseConfig();
private DdlHandler handler(DatabasePlatform platform) {
return PlatformDdlBuilder.create(platform).createDdlHandler(serverConfig);
diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdlTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdlTest.java
index dc63608af..f6d42cb29 100644
--- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdlTest.java
+++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdlTest.java
@@ -20,7 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
class BaseTableDdlTest {
- private final DatabaseBuilder serverConfig = new DatabaseConfig();
+ private final DatabaseConfig serverConfig = new DatabaseConfig();
private final PlatformDdl h2ddl = PlatformDdlBuilder.create(new H2Platform());
@Test
diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_AlterColumnTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_AlterColumnTest.java
index 733368700..52ca8e96e 100644
--- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_AlterColumnTest.java
+++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_AlterColumnTest.java
@@ -36,7 +36,7 @@ public class PlatformDdl_AlterColumnTest {
private final SoftAssertions softly = new SoftAssertions();
{
- DatabaseBuilder serverConfig = DB.getDefault().pluginApi().config();
+ DatabaseBuilder.Settings serverConfig = DB.getDefault().pluginApi().config();
sqlServerDdl.configure(serverConfig);
}
diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_CreateIndexTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_CreateIndexTest.java
index 9c7c55c7d..0b26df48a 100644
--- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_CreateIndexTest.java
+++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_CreateIndexTest.java
@@ -27,7 +27,7 @@ public class PlatformDdl_CreateIndexTest {
private final PlatformDdl db2LuwDdl = PlatformDdlBuilder.create(new DB2LuwPlatform());
{
- DatabaseBuilder config = DB.getDefault().pluginApi().config();
+ DatabaseBuilder.Settings config = DB.getDefault().pluginApi().config();
h2Ddl.configure(config);
pgDdl.configure(config);
mysqlDdl.configure(config);
@@ -38,7 +38,6 @@ public class PlatformDdl_CreateIndexTest {
}
WriteCreateIndex writeCreateIndex() {
-
return writeCreateIndex(true, true);
}
diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_dropUniqueConstraintTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_dropUniqueConstraintTest.java
index 35e012a5f..75a5b7430 100644
--- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_dropUniqueConstraintTest.java
+++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl_dropUniqueConstraintTest.java
@@ -49,7 +49,7 @@ public class PlatformDdl_dropUniqueConstraintTest {
sql = mysqlDdl.alterTableDropUniqueConstraint("mytab", "uq_name");
assertEquals("alter table mytab drop index uq_name", sql);
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
hanaDdl.configure(config);
sql = hanaDdl.alterTableDropUniqueConstraint("mytab", "uq_name");
assertEquals("delimiter $$\n" +
diff --git a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/model/build/ModelBuildBeanVisitorTest.java b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/model/build/ModelBuildBeanVisitorTest.java
index 51fbf6605..53a8a6038 100644
--- a/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/model/build/ModelBuildBeanVisitorTest.java
+++ b/ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/model/build/ModelBuildBeanVisitorTest.java
@@ -55,7 +55,7 @@ public class ModelBuildBeanVisitorTest extends BaseTestCase {
ModelContainer model = new ModelContainer();
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2");
config.loadFromProperties();
config.setName("h2other");
diff --git a/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisExtraTypeFactory.java b/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisExtraTypeFactory.java
index 1630f968c..67c3cc7df 100644
--- a/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisExtraTypeFactory.java
+++ b/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisExtraTypeFactory.java
@@ -16,7 +16,7 @@ import java.util.List;
public class PostgisExtraTypeFactory implements ExtraTypeFactory {
@Override
- public List> createTypes(DatabaseBuilder config, Object objectMapper) {
+ public List> createTypes(DatabaseBuilder.Settings config, Object objectMapper) {
List> list = new ArrayList<>();
list.add(new ScalarTypePgisPoint());
diff --git a/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisGeoTypeBindProvider.java b/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisGeoTypeBindProvider.java
index ab151db1d..2b4bbd7a1 100644
--- a/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisGeoTypeBindProvider.java
+++ b/ebean-postgis-types/src/main/java/io/ebean/postgis/PostgisGeoTypeBindProvider.java
@@ -7,7 +7,7 @@ import io.ebeaninternal.server.type.GeoTypeBinder;
public class PostgisGeoTypeBindProvider implements GeoTypeProvider {
@Override
- public GeoTypeBinder createBinder(DatabaseBuilder config) {
+ public GeoTypeBinder createBinder(DatabaseBuilder.Settings config) {
boolean withGeolatte = config.getClassLoadConfig().isPresent("org.geolatte.geom.Geometry");
return new PostgisGeoTypeBinder(withGeolatte);
}
diff --git a/ebean-redis/src/main/java/io/ebean/redis/RedisCacheFactory.java b/ebean-redis/src/main/java/io/ebean/redis/RedisCacheFactory.java
index 6eda94bbd..e92676b89 100644
--- a/ebean-redis/src/main/java/io/ebean/redis/RedisCacheFactory.java
+++ b/ebean-redis/src/main/java/io/ebean/redis/RedisCacheFactory.java
@@ -74,7 +74,7 @@ final class RedisCacheFactory implements ServerCacheFactory {
private final ReentrantLock lock = new ReentrantLock();
private ServerCacheNotify listener;
- RedisCacheFactory(DatabaseBuilder config, BackgroundExecutor executor) {
+ RedisCacheFactory(DatabaseBuilder.Settings config, BackgroundExecutor executor) {
this.executor = executor;
this.nearCacheNotify = new DNearCacheNotify();
MetricFactory factory = MetricFactory.get();
@@ -95,7 +95,7 @@ final class RedisCacheFactory implements ServerCacheFactory {
/**
* Return the JedisPool to use (only 1 at this stage).
*/
- private JedisPool getJedisPool(DatabaseBuilder config) {
+ private JedisPool getJedisPool(DatabaseBuilder.Settings config) {
JedisPool jedisPool = config.getServiceObject(JedisPool.class);
if (jedisPool != null) {
return jedisPool;
diff --git a/ebean-redis/src/main/java/io/ebean/redis/RedisCachePlugin.java b/ebean-redis/src/main/java/io/ebean/redis/RedisCachePlugin.java
index 1edea4674..e2fcc6fc7 100644
--- a/ebean-redis/src/main/java/io/ebean/redis/RedisCachePlugin.java
+++ b/ebean-redis/src/main/java/io/ebean/redis/RedisCachePlugin.java
@@ -12,6 +12,6 @@ public class RedisCachePlugin implements ServerCachePlugin {
*/
@Override
public ServerCacheFactory create(DatabaseBuilder config, BackgroundExecutor executor) {
- return new RedisCacheFactory(config, executor);
+ return new RedisCacheFactory(config.settings(), executor);
}
}
diff --git a/ebean-test/pom.xml b/ebean-test/pom.xml
index ab056e9c0..b5b3ab1ef 100644
--- a/ebean-test/pom.xml
+++ b/ebean-test/pom.xml
@@ -135,14 +135,14 @@
io.ebean
ebean-joda-time
- 13.24.0-RC1
+ 13.24.0-RC2
test
io.ebean
ebean-jackson-jsonnode
- 13.24.0-RC1
+ 13.24.0-RC2
test
diff --git a/ebean-test/src/main/java/io/ebean/test/config/AutoConfigureForTesting.java b/ebean-test/src/main/java/io/ebean/test/config/AutoConfigureForTesting.java
index 3ff4c5113..668eb86bf 100644
--- a/ebean-test/src/main/java/io/ebean/test/config/AutoConfigureForTesting.java
+++ b/ebean-test/src/main/java/io/ebean/test/config/AutoConfigureForTesting.java
@@ -31,7 +31,8 @@ public class AutoConfigureForTesting implements AutoConfigure {
private final String environmentDb = System.getProperty("db");
@Override
- public void preConfigure(DatabaseBuilder config) {
+ public void preConfigure(DatabaseBuilder builder) {
+ var config = builder.settings();
Properties properties = config.getProperties();
if (properties != null) {
// trigger determination of docker.host system property if not already done
@@ -55,7 +56,8 @@ public class AutoConfigureForTesting implements AutoConfigure {
}
@Override
- public void postConfigure(DatabaseBuilder config) {
+ public void postConfigure(DatabaseBuilder builder) {
+ var config = builder.settings();
if (!config.isDefaultServer()) {
return;
}
@@ -87,7 +89,7 @@ public class AutoConfigureForTesting implements AutoConfigure {
/**
* Check if this is not the primary server and return true if that is the case.
*/
- private boolean isExtraServer(DatabaseBuilder config, Properties properties) {
+ private boolean isExtraServer(DatabaseBuilder.Settings config, Properties properties) {
String extraDb = properties.getProperty("ebean.test.extraDb.dbName", properties.getProperty("ebean.test.extraDb"));
if (extraDb != null && extraDb.equals(config.getName())) {
config.setDefaultServer(false);
@@ -99,7 +101,7 @@ public class AutoConfigureForTesting implements AutoConfigure {
/**
* Setup the DataSource on the extra database if necessary.
*/
- private void setupExtraDataSourceIfNecessary(DatabaseBuilder config) {
+ private void setupExtraDataSourceIfNecessary(DatabaseBuilder.Settings config) {
DataSourceBuilder dataSourceConfig = config.getDataSourceConfig();
if (dataSourceConfig == null || dataSourceConfig.settings().getUsername() == null) {
new PlatformAutoConfig(environmentDb, config)
@@ -110,14 +112,14 @@ public class AutoConfigureForTesting implements AutoConfigure {
/**
* Setup support for Who, Multi-Tenant and DB encryption if they are not already set.
*/
- private void setupProviders(DatabaseBuilder config) {
+ private void setupProviders(DatabaseBuilder.Settings config) {
new ProviderAutoConfig(config).run();
}
/**
* Setup the platform for testing including docker as needed and adjusting datasource config as needed.
*/
- private void setupPlatform(String db, DatabaseBuilder config) {
+ private void setupPlatform(String db, DatabaseBuilder.Settings config) {
new PlatformAutoConfig(db, config).run();
}
}
diff --git a/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java b/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java
index 67feefc14..3c8488798 100644
--- a/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java
+++ b/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java
@@ -37,11 +37,11 @@ class Config {
private String schema;
private String username;
private String password;
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
private boolean containerDropCreate;
private final Properties dockerProperties = new Properties();
- Config(String db, String platform, String databaseName, DatabaseBuilder config) {
+ Config(String db, String platform, String databaseName, DatabaseBuilder.Settings config) {
this.db = db;
this.platform = platform;
this.dockerPlatform = platform;
diff --git a/ebean-test/src/main/java/io/ebean/test/config/platform/PlatformAutoConfig.java b/ebean-test/src/main/java/io/ebean/test/config/platform/PlatformAutoConfig.java
index aa2d84710..8ef841025 100644
--- a/ebean-test/src/main/java/io/ebean/test/config/platform/PlatformAutoConfig.java
+++ b/ebean-test/src/main/java/io/ebean/test/config/platform/PlatformAutoConfig.java
@@ -38,14 +38,14 @@ public class PlatformAutoConfig {
KNOWN_PLATFORMS.put("yugabyte", new YugabyteSetup());
}
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
private final Properties properties;
private String db;
private String platform;
private PlatformSetup platformSetup;
private String databaseName;
- public PlatformAutoConfig(String db, DatabaseBuilder config) {
+ public PlatformAutoConfig(String db, DatabaseBuilder.Settings config) {
this.db = db;
this.config = config;
this.properties = config.getProperties();
diff --git a/ebean-test/src/main/java/io/ebean/test/config/provider/ProviderAutoConfig.java b/ebean-test/src/main/java/io/ebean/test/config/provider/ProviderAutoConfig.java
index c5658f229..2c2983436 100644
--- a/ebean-test/src/main/java/io/ebean/test/config/provider/ProviderAutoConfig.java
+++ b/ebean-test/src/main/java/io/ebean/test/config/provider/ProviderAutoConfig.java
@@ -16,10 +16,10 @@ public class ProviderAutoConfig {
private static final System.Logger log = AppLog.getLogger("io.ebean.test");
- private final DatabaseBuilder config;
+ private final DatabaseBuilder.Settings config;
private final Properties properties;
- public ProviderAutoConfig(DatabaseBuilder config) {
+ public ProviderAutoConfig(DatabaseBuilder.Settings config) {
this.config = config;
this.properties = config.getProperties();
}
diff --git a/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java b/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java
index 168629694..94ed1a9bb 100644
--- a/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java
+++ b/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java
@@ -38,7 +38,7 @@ class ConfigTest {
@Test
void extensions_whenNoSetValues() {
- DatabaseBuilder databaseBuilder = new DatabaseConfig();
+ DatabaseConfig databaseBuilder = new DatabaseConfig();
databaseBuilder.loadFromProperties(new Properties());
Config config = new Config("db", "postgis", "db", databaseBuilder);
@@ -56,7 +56,7 @@ class ConfigTest {
@Test
void extensions_whenSetValues() {
- DatabaseBuilder databaseBuilder = new DatabaseConfig();
+ DatabaseConfig databaseBuilder = new DatabaseConfig();
Properties properties = new Properties();
properties.setProperty("ebean.test.extensions", "x,y");
properties.setProperty("ebean.test.extraDb.extensions", "z");
@@ -78,7 +78,7 @@ class ConfigTest {
Properties p = new Properties();
p.setProperty("ebean.test.extraDb", "other");
- DatabaseBuilder serverConfig = new DatabaseConfig();
+ DatabaseConfig serverConfig = new DatabaseConfig();
serverConfig.loadFromProperties(p);
Config config = new Config("other", "postgres", "other", serverConfig);
@@ -100,7 +100,7 @@ class ConfigTest {
Properties p = new Properties();
p.setProperty("ebean.test.extraDb.dbName", "other");
- DatabaseBuilder serverConfig = new DatabaseConfig();
+ DatabaseConfig serverConfig = new DatabaseConfig();
serverConfig.loadFromProperties(p);
Config config = new Config("other", "postgres", "other", serverConfig);
@@ -126,7 +126,7 @@ class ConfigTest {
p.setProperty("ebean.test.extraDb.password", "other_pwd");
p.setProperty("ebean.test.extraDb.url", "other_url");
- DatabaseBuilder serverConfig = new DatabaseConfig();
+ DatabaseConfig serverConfig = new DatabaseConfig();
serverConfig.setName("scOther");
serverConfig.loadFromProperties(p);
@@ -151,7 +151,7 @@ class ConfigTest {
sourceProperties.setProperty("ebean.test.dbName", "main");
sourceProperties.setProperty("ebean.test.extraDb.dbName", "central");
- DatabaseBuilder serverConfig = new DatabaseConfig();
+ DatabaseConfig serverConfig = new DatabaseConfig();
serverConfig.setName("main");
serverConfig.loadFromProperties(sourceProperties);
@@ -220,7 +220,7 @@ class ConfigTest {
}
private Config createConfig(Properties p) {
- DatabaseBuilder serverConfig = new DatabaseConfig();
+ DatabaseConfig serverConfig = new DatabaseConfig();
serverConfig.setName("scOther");
serverConfig.loadFromProperties(p);
return new Config("db_name", "postgres", "db_name", serverConfig);
diff --git a/ebean-test/src/test/java/io/ebean/xtest/config/DbMigrationConfigTest.java b/ebean-test/src/test/java/io/ebean/xtest/config/DbMigrationConfigTest.java
index 06b885191..34c7c3713 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/config/DbMigrationConfigTest.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/config/DbMigrationConfigTest.java
@@ -16,7 +16,7 @@ public class DbMigrationConfigTest {
@Test
public void testLoad() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2other");
config.loadFromProperties();
config.setDefaultServer(false);
diff --git a/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java b/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java
index 34afc8256..db3c9622b 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/config/PlatformNoGeneratedKeysTest.java
@@ -89,7 +89,7 @@ public class PlatformNoGeneratedKeysTest {
private static Database testH2Server() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2_noGeneratedKeys");
OtherH2Platform platform = new OtherH2Platform();
diff --git a/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationGenerateTest.java b/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationGenerateTest.java
index 8b387a8da..6d19a976b 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationGenerateTest.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/dbmigration/DbMigrationGenerateTest.java
@@ -89,7 +89,7 @@ public class DbMigrationGenerateTest {
migration.addPlatform(Platform.YUGABYTE);
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("migrationtest");
config.loadFromProperties();
config.setRegister(false);
diff --git a/ebean-test/src/test/java/io/ebean/xtest/event/BeanFindControllerTest.java b/ebean-test/src/test/java/io/ebean/xtest/event/BeanFindControllerTest.java
index 8032a4f7e..03e9518a7 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/event/BeanFindControllerTest.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/event/BeanFindControllerTest.java
@@ -27,7 +27,7 @@ public class BeanFindControllerTest extends BaseTestCase {
@Test
public void test() {
- DatabaseBuilder config = new DatabaseConfig();
+ var config = new DatabaseConfig();
config.setName("h2otherfind");
config.loadFromProperties();
@@ -170,7 +170,7 @@ public class BeanFindControllerTest extends BaseTestCase {
}
private Database prepareSoftRefs() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2otherfind");
config.loadFromProperties();
diff --git a/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiEbeanServer.java b/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiEbeanServer.java
index c44de8899..184ef9009 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiEbeanServer.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiEbeanServer.java
@@ -126,7 +126,7 @@ public class TDSpiEbeanServer extends TDSpiServer implements SpiEbeanServer {
}
@Override
- public DatabaseBuilder config() {
+ public DatabaseBuilder.Settings config() {
return null;
}
diff --git a/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiServer.java b/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiServer.java
index 301b2aa0f..6efedcacb 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiServer.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/internal/api/TDSpiServer.java
@@ -579,7 +579,7 @@ public class TDSpiServer implements SpiServer {
}
@Override
- public DatabaseBuilder config() {
+ public DatabaseBuilder.Settings config() {
return null;
}
diff --git a/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/DJsonScalarTest.java b/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/DJsonScalarTest.java
index 295bdcd4b..e39ee30db 100644
--- a/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/DJsonScalarTest.java
+++ b/ebean-test/src/test/java/io/ebean/xtest/internal/server/text/json/DJsonScalarTest.java
@@ -24,7 +24,7 @@ public class DJsonScalarTest {
private final DJsonScalar jsonScalar;
public DJsonScalarTest() {
- DatabaseBuilder serverConfig = new DatabaseConfig();
+ var serverConfig = new DatabaseConfig();
serverConfig.setDatabasePlatform(new H2Platform());
DefaultTypeManager typeManager = new DefaultTypeManager(serverConfig, new BootupClasses());
jsonScalar = new DJsonScalar(typeManager);
diff --git a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java
index cc18f4a95..a41255450 100644
--- a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java
+++ b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContext.java
@@ -258,7 +258,7 @@ public class TestPersistenceContext extends BaseTestCase {
@Test
@Disabled
void initDb() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2-batch");
config.loadFromProperties();
config.setDdlExtra(false);
@@ -292,7 +292,7 @@ public class TestPersistenceContext extends BaseTestCase {
@Test
@Disabled
void testFindEachFindList() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2-batch");
config.loadFromProperties();
config.setDdlRun(false);
diff --git a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java
index 8fd251873..cf91280b7 100644
--- a/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java
+++ b/ebean-test/src/test/java/org/tests/basic/TestPersistenceContextMany.java
@@ -98,7 +98,7 @@ public class TestPersistenceContextMany extends BaseTestCase {
@Test
@Disabled
void initDb() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2-batch");
config.loadFromProperties();
config.setDdlExtra(false);
@@ -142,7 +142,7 @@ public class TestPersistenceContextMany extends BaseTestCase {
@Test
@Disabled
void testFindEachFindList() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setName("h2-batch");
config.loadFromProperties();
config.setDdlRun(false);
diff --git a/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java b/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java
index daaa7c70e..91d83fd14 100644
--- a/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java
+++ b/ebean-test/src/test/java/org/tests/json/TestJsonSourceDefault.java
@@ -23,7 +23,7 @@ class TestJsonSourceDefault {
@ForPlatform(Platform.H2)
@Disabled
void testDirtyValues_diffSource() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.getDataSourceConfig()
.setUsername("sa")
.setPassword("")
diff --git a/platforms/sqlserver/src/test/java/io/ebean/platform/sqlserver/SqlServerPlatformTest.java b/platforms/sqlserver/src/test/java/io/ebean/platform/sqlserver/SqlServerPlatformTest.java
index 7277c226b..2726b575f 100644
--- a/platforms/sqlserver/src/test/java/io/ebean/platform/sqlserver/SqlServerPlatformTest.java
+++ b/platforms/sqlserver/src/test/java/io/ebean/platform/sqlserver/SqlServerPlatformTest.java
@@ -12,7 +12,7 @@ class SqlServerPlatformTest {
@Test
public void convertQuotedIdentifiers_when_allQuotedIdentifier_sqlServer() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
config.setAllQuotedIdentifiers(true);
config.setNamingConvention(new MatchingNamingConvention());
@@ -26,7 +26,7 @@ class SqlServerPlatformTest {
@Test
public void convertQuotedIdentifiers() {
- DatabaseBuilder config = new DatabaseConfig();
+ DatabaseConfig config = new DatabaseConfig();
SqlServer17Platform dbPlatform = new SqlServer17Platform();
dbPlatform.configure(config.getPlatformConfig());