Module io.ebean.api
Package io.ebean

Interface DatabaseBuilder.Settings

All Superinterfaces:
DatabaseBuilder
All Known Implementing Classes:
DatabaseConfig
Enclosing interface:
DatabaseBuilder

public static interface DatabaseBuilder.Settings extends DatabaseBuilder
Provides read access (getters) for the DatabaseBuilder configuration that has been set.
  • Method Details

    • isAutoLoadModuleInfo

      @Deprecated(forRemoval=true) boolean isAutoLoadModuleInfo()
      Deprecated, for removal: This API element is subject to removal in a future version.
      - migrate to isLoadModuleInfo().
    • getJsonFactory

      com.fasterxml.jackson.core.JsonFactory getJsonFactory()
      Return the Jackson JsonFactory to use.

      If not set a default implementation will be used.

    • getClock

      Clock getClock()
      Get the clock used for setting the timestamps (e.g. @UpdatedTimestamp) on objects.
    • getSlowQueryMillis

      long getSlowQueryMillis()
      Return the slow query time in millis.
    • getSlowQueryListener

      SlowQueryListener getSlowQueryListener()
      Return the slow query event listener.
    • getServiceObject

      Object getServiceObject(String key)
      Return the service object given the key.
    • getServiceObject

      <P> P getServiceObject(Class<P> cls)
      Used by ebean or plugins to obtain service objects.
      
      
         JedisPool jedisPool = config.getServiceObject(JedisPool.class);
      
       
      Parameters:
      cls - The type of the service object to obtain
      Returns:
      The service object given the class type
    • getJsonDateTime

      JsonConfig.DateTime getJsonDateTime()
      Return the JSON format used for DateTime types.
    • getJsonDate

      JsonConfig.Date getJsonDate()
      Return the JSON format used for Date types.
    • getJsonInclude

      JsonConfig.Include getJsonInclude()
      Return the JSON include mode used when writing JSON.
    • getJsonMutationDetection

      io.ebean.annotation.MutationDetection getJsonMutationDetection()
      Return the default MutableDetection to use with @DbJson using Jackson.
      See Also:
      • DbJson.mutationDetection()
    • getName

      String getName()
      Return the name of the Database.
    • getContainerConfig

      ContainerConfig getContainerConfig()
      Return the container / clustering configuration.

      The container holds all the Database instances and provides clustering communication services to all the Database instances.

    • isRegister

      boolean isRegister()
      Return true if this server should be registered with the Ebean singleton when it is created.

      By default this is set to true.

    • isDefaultServer

      boolean isDefaultServer()
      Return true if this server should be registered as the "default" server with the Ebean singleton.

      This is only used when DatabaseBuilder.setRegister(boolean) is also true.

    • getCurrentUserProvider

      CurrentUserProvider getCurrentUserProvider()
      Return the CurrentUserProvider. This is used to populate @WhoCreated, @WhoModified and support other audit features (who executed a query etc).
    • getTenantMode

      TenantMode getTenantMode()
      Return the tenancy mode used.
    • getTenantPartitionColumn

      String getTenantPartitionColumn()
      Return the column name used for TenantMode.PARTITION.
    • getCurrentTenantProvider

      CurrentTenantProvider getCurrentTenantProvider()
      Return the current tenant provider.
    • getTenantDataSourceProvider

      TenantDataSourceProvider getTenantDataSourceProvider()
      Return the tenancy datasource provider.
    • getTenantSchemaProvider

      TenantSchemaProvider getTenantSchemaProvider()
      Return the tenancy schema provider.
    • getPersistBatch

      io.ebean.annotation.PersistBatch getPersistBatch()
      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.

    • getPersistBatchOnCascade

      io.ebean.annotation.PersistBatch getPersistBatchOnCascade()
      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.

    • getPersistBatchSize

      int getPersistBatchSize()
      Return the batch size used for JDBC batching. This defaults to 20.
    • getQueryBatchSize

      int getQueryBatchSize()
      Gets the query batch size. This defaults to 100.
      Returns:
      the query batch size
    • getDefaultEnumType

      jakarta.persistence.EnumType getDefaultEnumType()
    • isDisableLazyLoading

      boolean isDisableLazyLoading()
      Return true if lazy loading is disabled on queries by default.
    • getLazyLoadBatchSize

      int getLazyLoadBatchSize()
      Return the default batch size for lazy loading of beans and collections.
    • getJdbcFetchSizeFindList

      int getJdbcFetchSizeFindList()
      Return the default JDBC fetchSize hint for findList queries.
    • getJdbcFetchSizeFindEach

      int getJdbcFetchSizeFindEach()
      Return the default JDBC fetchSize hint for findEach/findEachWhile queries.
    • getChangeLogPrepare

      ChangeLogPrepare getChangeLogPrepare()
      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.

    • getChangeLogListener

      ChangeLogListener getChangeLogListener()
      Return the ChangeLogListener which actually performs the logging of change sets in the background.
    • getChangeLogRegister

      ChangeLogRegister getChangeLogRegister()
      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.
    • isChangeLogIncludeInserts

      boolean isChangeLogIncludeInserts()
      Return true if inserts should be included in the change log by default.
    • isChangeLogAsync

      boolean isChangeLogAsync()
      Return true (default) if the changelog should be written async.
    • getTenantCatalogProvider

      TenantCatalogProvider getTenantCatalogProvider()
      Return the tenancy catalog provider.
    • getProfilingConfig

      ProfilingConfig getProfilingConfig()
      Return the configuration for profiling.
    • getDbSchema

      String getDbSchema()
      Return the DB schema to use.
    • getGeometrySRID

      int getGeometrySRID()
      Return the Geometry SRID.
    • getDataTimeZone

      String getDataTimeZone()
      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.

    • getAsOfViewSuffix

      String getAsOfViewSuffix()
      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.
    • getAsOfSysPeriod

      String getAsOfSysPeriod()
      Return the database column used to support history and 'As of' queries. This column is a timestamp range or equivalent.
    • getHistoryTableSuffix

      String getHistoryTableSuffix()
      Return the history table suffix (defaults to _history).
    • isUseJtaTransactionManager

      boolean isUseJtaTransactionManager()
      Return true if we are running in a JTA Transaction manager.
    • getExternalTransactionManager

      ExternalTransactionManager getExternalTransactionManager()
      Return the external transaction manager.
    • getServerCachePlugin

      ServerCachePlugin getServerCachePlugin()
      Return the ServerCachePlugin.
    • isEagerFetchLobs

      boolean isEagerFetchLobs()
      Return true if LOB's should default to fetch eager. By default this is set to false and LOB's must be explicitly fetched.
    • getMaxCallStack

      int getMaxCallStack()
      Return the max call stack to use for origin location.
    • isTransactionRollbackOnChecked

      boolean isTransactionRollbackOnChecked()
      Return true if transactions should rollback on checked exceptions.
    • getBackgroundExecutorSchedulePoolSize

      int getBackgroundExecutorSchedulePoolSize()
      Return the Background executor schedule pool size. Defaults to 1.
    • getBackgroundExecutorShutdownSecs

      int getBackgroundExecutorShutdownSecs()
      Return the Background executor shutdown seconds. This is the time allowed for the pool to shutdown nicely before it is forced shutdown.
    • getBackgroundExecutorWrapper

      BackgroundExecutorWrapper getBackgroundExecutorWrapper()
      Return the background executor wrapper.
    • isAutoPersistUpdates

      boolean isAutoPersistUpdates()
      Return true if dirty beans are automatically persisted.
    • getCacheMaxSize

      int getCacheMaxSize()
      Return the L2 cache default max size.
    • getCacheMaxIdleTime

      int getCacheMaxIdleTime()
      Return the L2 cache default max idle time in seconds.
    • getCacheMaxTimeToLive

      int getCacheMaxTimeToLive()
      Return the L2 cache default max time to live in seconds.
    • getQueryCacheMaxSize

      int getQueryCacheMaxSize()
      Return the L2 query cache default max size.
    • getQueryCacheMaxIdleTime

      int getQueryCacheMaxIdleTime()
      Return the L2 query cache default max idle time in seconds.
    • getQueryCacheMaxTimeToLive

      int getQueryCacheMaxTimeToLive()
      Return the L2 query cache default max time to live in seconds.
    • getNamingConvention

      NamingConvention getNamingConvention()
      Return the NamingConvention.

      If none has been set the default UnderscoreNamingConvention is used.

    • isAllQuotedIdentifiers

      boolean isAllQuotedIdentifiers()
      Return true if all DB column and table names should use quoted identifiers.
    • getConstraintNaming

      DbConstraintNaming getConstraintNaming()
      Return the constraint naming convention used in DDL generation.
    • getAutoTuneConfig

      AutoTuneConfig getAutoTuneConfig()
      Return the configuration for AutoTune.
    • skipDataSourceCheck

      boolean skipDataSourceCheck()
      Return true if the startup DataSource check should be skipped.
    • readOnlyDatabase

      boolean readOnlyDatabase()
      Return true if this database is used in a read only way.

      The DataSource and read-only DataSource are expected to be the same and use readOnly=true and autoCommit=true.

    • getDataSource

      DataSource getDataSource()
      Return the DataSource.
    • getReadOnlyDataSource

      DataSource getReadOnlyDataSource()
      Return the read only DataSource.
    • getDataSourceConfig

      io.ebean.datasource.DataSourceBuilder.Settings getDataSourceConfig()
      Return the configuration to build a DataSource using Ebean's own DataSource implementation.
    • isAutoReadOnlyDataSource

      boolean isAutoReadOnlyDataSource()
      Return true if Ebean should create a DataSource for use with implicit read only transactions.
    • getReadOnlyDataSourceConfig

      io.ebean.datasource.DataSourceBuilder.Settings getReadOnlyDataSourceConfig()
      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.

    • getDatabaseBooleanTrue

      String getDatabaseBooleanTrue()
      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").

    • getDatabaseBooleanFalse

      String getDatabaseBooleanFalse()
      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").

    • getDatabaseSequenceBatchSize

      int getDatabaseSequenceBatchSize()
      Return the number of DB sequence values that should be preallocated.
    • getDatabasePlatformName

      String getDatabasePlatformName()
      Return the database platform name (can be null).

      If null then the platform is determined automatically via the JDBC driver information.

    • getDatabasePlatform

      DatabasePlatform getDatabasePlatform()
      Return the database platform to use for this database.
    • getIdType

      IdType getIdType()
      Return the preferred DB platform IdType.
    • getEncryptKeyManager

      EncryptKeyManager getEncryptKeyManager()
      Return the EncryptKeyManager.
    • getEncryptDeployManager

      EncryptDeployManager getEncryptDeployManager()
      Return the EncryptDeployManager.

      This is optionally used to programmatically define which columns are encrypted instead of using the Encrypted Annotation.

    • getEncryptor

      Encryptor getEncryptor()
      Return the Encryptor used to encrypt data on the java client side (as opposed to DB encryption functions).
    • isDbOffline

      boolean isDbOffline()
      Return true if the Database instance should be created in offline mode.
    • getDbEncrypt

      DbEncrypt getDbEncrypt()
      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.

    • getPlatformConfig

      PlatformConfig getPlatformConfig()
      Return the configuration for DB types (such as UUID and custom mappings).
    • appliedPersistBatchOnCascade

      io.ebean.annotation.PersistBatch appliedPersistBatchOnCascade()
      Return the PersistBatch mode to use for 'batchOnCascade' taking into account if the database platform supports getGeneratedKeys in batch mode.
    • getUuidVersion

      DatabaseConfig.UuidVersion getUuidVersion()
      Returns the UUID version mode.
    • getUuidStateFile

      String getUuidStateFile()
      Return the UUID state file.
    • getUuidNodeId

      String getUuidNodeId()
      Returns the V1-UUID-NodeId
    • isLocalTimeWithNanos

      boolean isLocalTimeWithNanos()
      Return true if LocalTime should be persisted with nanos precision.
    • isDurationWithNanos

      boolean isDurationWithNanos()
      Return true if Duration should be persisted with nanos precision (SQL DECIMAL).

      Otherwise it is persisted with second precision (SQL INTEGER).

    • isRunMigration

      boolean isRunMigration()
      Return true if the DB migration should run on server start.
    • isDdlCreateOnly

      boolean isDdlCreateOnly()
      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.

    • getDdlSeedSql

      String getDdlSeedSql()
      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.

    • getDdlInitSql

      String getDdlInitSql()
      Return a SQL script to execute before the "create all" DDL has been run.
    • isDdlGenerate

      boolean isDdlGenerate()
      Return true if the DDL should be generated.
    • isDdlRun

      boolean isDdlRun()
      Return true if the DDL should be run.
    • isDdlExtra

      boolean isDdlExtra()
      Return true, if extra-ddl.xml should be executed.
    • isDdlStrictMode

      boolean isDdlStrictMode()
      Return true if strict mode is used which includes a check that non-null columns have a default value.
    • getDdlHeader

      String getDdlHeader()
      Return the header to use with DDL generation.
    • getDdlPlaceholders

      String getDdlPlaceholders()
      Return a comma and equals delimited placeholders that are substituted in DDL scripts.
    • getDdlPlaceholderMap

      Map<String,String> getDdlPlaceholderMap()
      Return a map of placeholder values that are substituted in DDL scripts.
    • isDisableClasspathSearch

      boolean isDisableClasspathSearch()
      Return true if the class path search should be disabled.
    • getJodaLocalTimeMode

      String getJodaLocalTimeMode()
      Return the mode to use for Joda LocalTime support 'normal' or 'utc'.
    • getPackages

      List<String> getPackages()
      Return packages to search for entities via class path search.

      This is only used if classes have not been explicitly specified.

    • classes

      Set<Class<?>> classes()
      Return the classes registered for this database. Typically, this includes entities and perhaps listeners.
    • isSkipCacheAfterWrite

      boolean isSkipCacheAfterWrite()
      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.

      
      
         // 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 Also:
    • isUpdateAllPropertiesInBatch

      boolean isUpdateAllPropertiesInBatch()
      Returns true if updates in JDBC batch default to include all properties by default.
    • getResourceDirectory

      String getResourceDirectory()
      Returns the resource directory.
    • getClasses

      @Deprecated(forRemoval=true) Set<Class<?>> getClasses()
      Deprecated, for removal: This API element is subject to removal in a future version.
      - migrate to 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.

    • getQueryAdapters

      List<BeanQueryAdapter> getQueryAdapters()
      Return the BeanQueryAdapter instances.
    • getIdGenerators

      List<IdGenerator> getIdGenerators()
      Return the custom IdGenerator instances.
    • getFindControllers

      List<BeanFindController> getFindControllers()
      Return the list of BeanFindController instances.
    • getPostLoaders

      List<BeanPostLoad> getPostLoaders()
      Return the list of BeanPostLoader instances.
    • getPostConstructListeners

      List<BeanPostConstructListener> getPostConstructListeners()
      Return the list of BeanPostLoader instances.
    • getPersistControllers

      List<BeanPersistController> getPersistControllers()
      Return the BeanPersistController instances.
    • getPersistListeners

      List<BeanPersistListener> getPersistListeners()
      Return the BeanPersistListener instances.
    • getBulkTableEventListeners

      List<BulkTableEventListener> getBulkTableEventListeners()
      Return the list of BulkTableEventListener instances.
    • getServerConfigStartupListeners

      List<ServerConfigStartup> getServerConfigStartupListeners()
      Return the list of ServerConfigStartup instances.
    • getPersistenceContextScope

      PersistenceContextScope getPersistenceContextScope()
      Return the default PersistenceContextScope to be used if one is not explicitly set on a query.

      The PersistenceContextScope can specified on each query via .Query#setPersistenceContextScope(io.ebean.PersistenceContextScope). If it is not set on the query this default scope is used.

      See Also:
    • getClassLoadConfig

      ClassLoadConfig getClassLoadConfig()
      Return the ClassLoadConfig which is used to detect Joda, Java8 types etc and also create new instances of plugins given a className.
    • getProperties

      Properties getProperties()
      Return the properties that we used for configuration and were set via a call to loadFromProperties().
    • getObjectMapper

      Object getObjectMapper()
      Return the Jackson ObjectMapper.

      Note that this is not strongly typed as Jackson ObjectMapper is an optional dependency.

    • isExpressionEqualsWithNullAsNoop

      boolean isExpressionEqualsWithNullAsNoop()
      Return true if eq("someProperty", null) should to generate "1=1" rather than "is null" sql expression.
    • isExpressionNativeIlike

      boolean isExpressionNativeIlike()
      Return true if native ILIKE expression should be used if supported by the database platform (e.g. Postgres).
    • getEnabledL2Regions

      String getEnabledL2Regions()
      Return the enabled L2 cache regions.
    • isDisableL2Cache

      boolean isDisableL2Cache()
      Return true if L2 cache is disabled.
    • isLocalOnlyL2Cache

      boolean isLocalOnlyL2Cache()
      Return true to use local only L2 cache. Effectively ignore l2 cache plugin like ebean-redis etc.
    • isUseValidationNotNull

      boolean isUseValidationNotNull()
      Returns if we use javax.validation.constraints.NotNull
    • isNotifyL2CacheInForeground

      boolean isNotifyL2CacheInForeground()
      Return true if L2 cache notification should run in the foreground.
    • getQueryPlanTTLSeconds

      int getQueryPlanTTLSeconds()
      Return the time to live for ebean's internal query plan.
    • getMappingLocations

      List<String> getMappingLocations()
      Return mapping locations to search for xml mapping via class path search.
    • isIdGeneratorAutomatic

      boolean isIdGeneratorAutomatic()
      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.
    • isQueryPlanEnable

      boolean isQueryPlanEnable()
      Return true if query plan capture is enabled.
    • getQueryPlanThresholdMicros

      long getQueryPlanThresholdMicros()
      Return the query plan collection threshold in microseconds.
    • isQueryPlanCapture

      boolean isQueryPlanCapture()
      Return true if periodic capture of query plans is enabled.
    • getQueryPlanCapturePeriodSecs

      long getQueryPlanCapturePeriodSecs()
      Return the frequency to capture query plans.
    • getQueryPlanCaptureMaxTimeMillis

      long getQueryPlanCaptureMaxTimeMillis()
      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.

    • getQueryPlanCaptureMaxCount

      int getQueryPlanCaptureMaxCount()
      Return the max number of query plans captured per request.
    • getQueryPlanListener

      QueryPlanListener getQueryPlanListener()
      Return the listener used to process captured query plans.
    • isDumpMetricsOnShutdown

      boolean isDumpMetricsOnShutdown()
      Return true if metrics should be dumped when the server is shutdown.
    • getDumpMetricsOptions

      String getDumpMetricsOptions()
      Return the options for dumping metrics.
    • isLoadModuleInfo

      boolean isLoadModuleInfo()
      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.

    • isIncludeLabelInSql

      boolean isIncludeLabelInSql()
      Return true if generated sql select query should include an inline sql comment with the query label or profile location label.
    • getMetricNaming

      Function<String,String> getMetricNaming()
      Return the naming convention to apply to metrics names.
    • getLengthCheck

      LengthCheck getLengthCheck()
      Returns the length check mode.