- All Known Subinterfaces:
DatabaseBuilder.Settings
- All Known Implementing Classes:
DatabaseConfig
Note that settings()
provides access to read the builder configuration
(the getters). The DatabaseBuilder only has the methods to set builder configuration
(the setters) so use settings()
to access to everything.
// build the 'default' database using configuration
// from application.properties / application.yaml
Database db = Database.builder()
.loadFromProperties()
.build();
Create a non-default database and not register it with DB
. When
not registered the database can not by obtained via DB.byName(String)
.
Database database = Database.builder()
.setName("other"
.loadFromProperties()
.setRegister(false)
.setDefaultServer(false)
.addClass(EBasic.class)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Provides read access (getters) for the DatabaseBuilder configuration that has been set. -
Method Summary
Modifier and TypeMethodDescriptionadd
(IdGenerator idGenerator) Register a customer IdGenerator instance.add
(BeanPersistController beanPersistController) Register a BeanPersistController instance.add
(BeanPersistListener beanPersistListener) Register a BeanPersistListener instance.add
(BeanPostConstructListener listener) Register a BeanPostConstructListener instance.add
(BeanPostLoad postLoad) Register a BeanPostLoad instance.add
(BeanQueryAdapter beanQueryAdapter) Register a BeanQueryAdapter instance.add
(BulkTableEventListener bulkTableEventListener) Add a BulkTableEventListeneraddAll
(Collection<Class<?>> classList) Register all the classes (typically entity classes).Programmatically add classes (typically entities) that this server should use.addCustomMapping
(DbType type, String columnDefinition) Add a custom type mapping that applies to all platforms.addCustomMapping
(DbType type, String columnDefinition, io.ebean.annotation.Platform platform) Add a custom type mapping.addMappingLocation
(String mappingLocation) Add a mapping location to search for xml mapping via class path search.addPackage
(String packageName) Add a package to search for entities via class path search.addServerConfigStartup
(ServerConfigStartup configStartupListener) Add a ServerConfigStartup.default DatabaseBuilder
allQuotedIdentifiers
(boolean allQuotedIdentifiers) Set to true if all DB column and table names should use quoted identifiers.default DatabaseBuilder
alsoIf
(BooleanSupplier predicate, Consumer<DatabaseBuilder.Settings> apply) Conditionally apply configuration to this builder via a lambda.apply
(Consumer<DatabaseBuilder.Settings> applyConfiguration) Apply configuration to this builder using a lambda.default DatabaseBuilder
asOfSysPeriod
(String asOfSysPeriod) Set the database column used to support history and 'As of' queries.default DatabaseBuilder
asOfViewSuffix
(String asOfViewSuffix) 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.default DatabaseBuilder
autoPersistUpdates
(boolean autoPersistUpdates) Set to true if dirty beans are automatically persisted.default DatabaseBuilder
autoReadOnlyDataSource
(boolean autoReadOnlyDataSource) Set to true if Ebean should create a DataSource for use with implicit read only transactions.default DatabaseBuilder
autoTuneConfig
(AutoTuneConfig autoTuneConfig) Set the configuration for AutoTune.default DatabaseBuilder
backgroundExecutorSchedulePoolSize
(int backgroundExecutorSchedulePoolSize) Set the Background executor schedule pool size.default DatabaseBuilder
backgroundExecutorShutdownSecs
(int backgroundExecutorShutdownSecs) Set the Background executor shutdown seconds.default DatabaseBuilder
backgroundExecutorWrapper
(BackgroundExecutorWrapper backgroundExecutorWrapper) Sets the background executor wrapper.build()
Build and return the Database instance.default DatabaseBuilder
cacheMaxIdleTime
(int cacheMaxIdleTime) Set the L2 cache default max idle time in seconds.default DatabaseBuilder
cacheMaxSize
(int cacheMaxSize) Set the L2 cache default max size.default DatabaseBuilder
cacheMaxTimeToLive
(int cacheMaxTimeToLive) Set the L2 cache default max time to live in seconds.default DatabaseBuilder
changeLogAsync
(boolean changeLogAsync) Sets if the changelog should be written async (default = true).default DatabaseBuilder
changeLogIncludeInserts
(boolean changeLogIncludeInserts) Set if inserts should be included in the change log by default.default DatabaseBuilder
changeLogListener
(ChangeLogListener changeLogListener) Set the ChangeLogListener which actually performs the logging of change sets in the background.default DatabaseBuilder
changeLogPrepare
(ChangeLogPrepare changeLogPrepare) Set the ChangeLogPrepare.default DatabaseBuilder
changeLogRegister
(ChangeLogRegister changeLogRegister) 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 are included in the change log.classes
(Collection<Class<?>> classes) Set the list of classes (entities, listeners, scalarTypes etc) that should be used for this database.default DatabaseBuilder
classLoadConfig
(ClassLoadConfig classLoadConfig) Set the ClassLoadConfig which is used to detect Joda, Java8 types etc and also create new instances of plugins given a className.default DatabaseBuilder
Set the clock used for setting the timestamps (e.g.default DatabaseBuilder
constraintNaming
(DbConstraintNaming constraintNaming) Set the constraint naming convention used in DDL generation.default DatabaseBuilder
containerConfig
(ContainerConfig containerConfig) Set the container / clustering configuration.default DatabaseBuilder
currentTenantProvider
(CurrentTenantProvider currentTenantProvider) Set the current tenant provider.default DatabaseBuilder
currentUserProvider
(CurrentUserProvider currentUserProvider) Set the CurrentUserProvider.default DatabaseBuilder
databaseBooleanFalse
(String databaseFalse) Set the value to represent FALSE in the database.default DatabaseBuilder
databaseBooleanTrue
(String databaseTrue) Set the value to represent TRUE in the database.default DatabaseBuilder
databasePlatform
(DatabasePlatform databasePlatform) Explicitly set the database platform to use.default DatabaseBuilder
databasePlatformName
(String databasePlatformName) Explicitly set the database platform namedefault DatabaseBuilder
databaseSequenceBatch
(int databaseSequenceBatchSize) Set the number of DB sequence values that should be preallocated and cached by Ebean.default DatabaseBuilder
databaseSequenceBatchSize
(int databaseSequenceBatchSize) Set the number of sequences to fetch/preallocate when using DB sequences.default DatabaseBuilder
dataSource
(DataSource dataSource) Set a DataSource.default DatabaseBuilder
dataSourceBuilder
(io.ebean.datasource.DataSourceBuilder dataSourceConfig) Set the configuration required to build a DataSource using Ebean's own DataSource implementation.default DatabaseBuilder
dataTimeZone
(String dataTimeZone) Set the time zone to use when reading/writing Timestamps via JDBC.default DatabaseBuilder
Set the DbEncrypt used to encrypt and decrypt properties.default DatabaseBuilder
Set the DB schema to use.default DatabaseBuilder
dbUuid
(PlatformConfig.DbUuid dbUuid) Set the DB type used to store UUID.default DatabaseBuilder
ddlCreateOnly
(boolean ddlCreateOnly) Set to true if the "drop all ddl" should be skipped.default DatabaseBuilder
ddlExtra
(boolean ddlExtra) Set to false if you not want to run the extra-ddl.xml scripts.default DatabaseBuilder
ddlGenerate
(boolean ddlGenerate) Set to true to generate the "create all" DDL on startup.default DatabaseBuilder
Set the header to use with DDL generation.default DatabaseBuilder
ddlInitSql
(String ddlInitSql) Set a SQL script to execute before the "create all" DDL has been run.default DatabaseBuilder
ddlPlaceholderMap
(Map<String, String> ddlPlaceholderMap) Set a map of placeholder values that are substituted in DDL scripts.default DatabaseBuilder
ddlPlaceholders
(String ddlPlaceholders) Set a comma and equals delimited placeholders that are substituted in DDL scripts.default DatabaseBuilder
ddlRun
(boolean ddlRun) Set to true to run the generated "create all DDL" on startup.default DatabaseBuilder
ddlSeedSql
(String ddlSeedSql) Set a SQL script to execute after the "create all" DDL has been run.default DatabaseBuilder
ddlStrictMode
(boolean ddlStrictMode) Set to false to turn off strict mode allowing non-null columns to not have a default value.default DatabaseBuilder
defaultDatabase
(boolean defaultServer) Set false if you do not want this Database to be registered as the "default" database with the DB singleton.default DatabaseBuilder
defaultEnumType
(jakarta.persistence.EnumType defaultEnumType) Set the default mapping for enum type.default DatabaseBuilder
disableClasspathSearch
(boolean disableClasspathSearch) Set to true to disable the class path search even for the case where no entity bean classes have been registered.default DatabaseBuilder
disableL2Cache
(boolean disableL2Cache) Set to true to disable L2 caching.default DatabaseBuilder
disableLazyLoading
(boolean disableLazyLoading) Set to true to disable lazy loading by default.default DatabaseBuilder
dumpMetricsOnShutdown
(boolean dumpMetricsOnShutdown) Set to true if metrics should be dumped when the server is shutdown.default DatabaseBuilder
dumpMetricsOptions
(String dumpMetricsOptions) Include 'sql' or 'hash' in options such that they are included in the output.default DatabaseBuilder
durationWithNanos
(boolean durationWithNanos) Set to true if Duration should be persisted with nanos precision (SQL DECIMAL).default DatabaseBuilder
eagerFetchLobs
(boolean eagerFetchLobs) Set to true if you want LOB's to be fetch eager by default.default DatabaseBuilder
enabledL2Regions
(String enabledL2Regions) Set the enabled L2 cache regions (comma delimited).default DatabaseBuilder
encryptDeployManager
(EncryptDeployManager encryptDeployManager) Set the EncryptDeployManager.default DatabaseBuilder
encryptKeyManager
(EncryptKeyManager encryptKeyManager) Set the EncryptKeyManager.default DatabaseBuilder
Set the Encryptor used to encrypt data on the java client side (as opposed to DB encryption functions).default DatabaseBuilder
expressionEqualsWithNullAsNoop
(boolean expressionEqualsWithNullAsNoop) Set to true if you want eq("someProperty", null) to generate "1=1" rather than "is null" sql expression.default DatabaseBuilder
expressionNativeIlike
(boolean expressionNativeIlike) Set to true to use native ILIKE expression if supported by the database platform (e.g.default DatabaseBuilder
externalTransactionManager
(ExternalTransactionManager externalTransactionManager) Set the external transaction manager.default DatabaseBuilder
geometrySRID
(int geometrySRID) Set the Geometry SRID.default DatabaseBuilder
historyTableSuffix
(String historyTableSuffix) Set the history table suffix.default DatabaseBuilder
idGeneratorAutomatic
(boolean idGeneratorAutomatic) Set to false such that Id properties require explicit@GeneratedValue
mapping before they are assigned Identity or Sequence generation based on platform.default DatabaseBuilder
Set the preferred DB platform IdType.includeLabelInSql
(boolean includeLabelInSql) Set if generated SQL SELECT should include the query label as an inline SQL comment (to help reference back from the SQL to the code that executed the query.default DatabaseBuilder
jdbcFetchSizeFindEach
(int jdbcFetchSizeFindEach) Set the default JDBC fetchSize hint for findEach/findEachWhile queries.default DatabaseBuilder
jdbcFetchSizeFindList
(int jdbcFetchSizeFindList) Set the default JDBC fetchSize hint for findList queries.default DatabaseBuilder
jodaLocalTimeMode
(String jodaLocalTimeMode) Set the mode to use for Joda LocalTime support 'normal' or 'utc'.default DatabaseBuilder
jsonDate
(JsonConfig.Date jsonDate) Set the JSON format to use for Date types.default DatabaseBuilder
jsonDateTime
(JsonConfig.DateTime jsonDateTime) Set the JSON format to use for DateTime types.default DatabaseBuilder
jsonFactory
(com.fasterxml.jackson.core.JsonFactory jsonFactory) Set the Jackson JsonFactory to use.default DatabaseBuilder
jsonInclude
(JsonConfig.Include jsonInclude) Set the JSON include mode used when writing JSON.default DatabaseBuilder
jsonMutationDetection
(io.ebean.annotation.MutationDetection jsonMutationDetection) Set the default MutableDetection to use with@DbJson
using Jackson.default DatabaseBuilder
lazyLoadBatchSize
(int lazyLoadBatchSize) Set the default batch size for lazy loading.lengthCheck
(LengthCheck lengthCheck) Sets the length check mode.Load settings from application.properties, application.yaml and other sources.loadFromProperties
(Properties properties) Load the settings from the given propertiesdefault DatabaseBuilder
loadModuleInfo
(boolean loadModuleInfo) Set false to turn off automatic registration of entity beans.default DatabaseBuilder
localOnlyL2Cache
(boolean localOnlyL2Cache) Force the use of local only L2 cache.default DatabaseBuilder
localTimeWithNanos
(boolean localTimeWithNanos) Set to true if LocalTime should be persisted with nanos precision.default DatabaseBuilder
mappingLocations
(List<String> mappingLocations) Set mapping locations to search for xml mapping via class path search.default DatabaseBuilder
maxCallStack
(int maxCallStack) Set the max call stack to use for origin location.default DatabaseBuilder
metricNaming
(Function<String, String> metricNaming) Set the naming convention to apply to metrics names.default DatabaseBuilder
Set the name of the Database.default DatabaseBuilder
namingConvention
(NamingConvention namingConvention) Set the NamingConvention.newPlatformConfig
(String propertiesPath, String platformPrefix) Create a new PlatformConfig based of the one held but with overridden properties by reading properties with the given path and prefix.default DatabaseBuilder
notifyL2CacheInForeground
(boolean notifyL2CacheInForeground) Set this to true to run L2 cache notification in the foreground.default DatabaseBuilder
objectMapper
(Object objectMapper) Set the Jackson ObjectMapper.default DatabaseBuilder
offline
(boolean dbOffline) Set to true if the Database instance should be created in offline mode.default DatabaseBuilder
persistBatch
(io.ebean.annotation.PersistBatch persistBatch) Set the JDBC batch mode to use at the transaction level.default DatabaseBuilder
persistBatching
(boolean persistBatching) Deprecated, please migrate to using setPersistBatch().default DatabaseBuilder
persistBatchOnCascade
(io.ebean.annotation.PersistBatch persistBatchOnCascade) Set the JDBC batch mode to use per save(), delete(), insert() or update() request.default DatabaseBuilder
persistBatchSize
(int persistBatchSize) Set the batch size used for JDBC batching.default DatabaseBuilder
persistenceContextScope
(PersistenceContextScope persistenceContextScope) Set the PersistenceContext scope to be used if one is not explicitly set on a query.default DatabaseBuilder
platformConfig
(PlatformConfig platformConfig) Set the configuration for DB platform (such as UUID and custom mappings).default DatabaseBuilder
profilingConfig
(ProfilingConfig profilingConfig) Set the configuration for profiling.<T> DatabaseBuilder
putServiceObject
(Class<T> iface, T configObject) Put a service object into configuration such that it can be used by ebean or a plugin.putServiceObject
(Object configObject) Put a service object into configuration such that it can be used by ebean or a plugin.putServiceObject
(String key, Object configObject) Put a service object into configuration such that it can be used by ebean or a plugin.default DatabaseBuilder
queryBatchSize
(int queryBatchSize) Sets the query batch size.default DatabaseBuilder
queryCacheMaxIdleTime
(int queryCacheMaxIdleTime) Set the L2 query cache default max idle time in seconds.default DatabaseBuilder
queryCacheMaxSize
(int queryCacheMaxSize) Set the L2 query cache default max size.default DatabaseBuilder
queryCacheMaxTimeToLive
(int queryCacheMaxTimeToLive) Set the L2 query cache default max time to live in seconds.default DatabaseBuilder
queryPlanCapture
(boolean queryPlanCapture) Set to true to turn on periodic capture of query plans.default DatabaseBuilder
queryPlanCaptureMaxCount
(int queryPlanCaptureMaxCount) Set the max number of query plans captured per request.default DatabaseBuilder
queryPlanCaptureMaxTimeMillis
(long queryPlanCaptureMaxTimeMillis) Set the time after which a capture query plans request will stop capturing more query plans.default DatabaseBuilder
queryPlanCapturePeriodSecs
(long queryPlanCapturePeriodSecs) Set the frequency in seconds to capture query plans.default DatabaseBuilder
queryPlanEnable
(boolean queryPlanEnable) Set to true to enable query plan capture.default DatabaseBuilder
queryPlanListener
(QueryPlanListener queryPlanListener) Set the listener used to process captured query plans.default DatabaseBuilder
queryPlanThresholdMicros
(long queryPlanThresholdMicros) Set the query plan collection threshold in microseconds.default DatabaseBuilder
queryPlanTTLSeconds
(int queryPlanTTLSeconds) Set the time to live for ebean's internal query plan.readOnlyDatabase
(boolean readOnlyDatabase) Set to true if this database is used in a read only way.default DatabaseBuilder
readOnlyDataSource
(DataSource readOnlyDataSource) Set the read only DataSource.default DatabaseBuilder
readOnlyDataSourceBuilder
(io.ebean.datasource.DataSourceBuilder readOnlyDataSourceConfig) Set the configuration for the read only DataSource.default DatabaseBuilder
register
(boolean register) Set to false if you do not want this server to be registered with the Ebean singleton when it is created.default DatabaseBuilder
resourceDirectory
(String resourceDirectory) Sets the resource directory.default DatabaseBuilder
runMigration
(boolean runMigration) Set to true to run DB migrations on server start.default DatabaseBuilder
serverCachePlugin
(ServerCachePlugin serverCachePlugin) Set the ServerCachePlugin to use.setAllQuotedIdentifiers
(boolean allQuotedIdentifiers) Deprecated.setAsOfSysPeriod
(String asOfSysPeriod) Deprecated.migrate toasOfSysPeriod(String)
.setAsOfViewSuffix
(String asOfViewSuffix) Deprecated.migrate toasOfViewSuffix(String)
.setAutoPersistUpdates
(boolean autoPersistUpdates) Deprecated.migrate toautoPersistUpdates(boolean)
.setAutoReadOnlyDataSource
(boolean autoReadOnlyDataSource) Deprecated.migrate toautoReadOnlyDataSource(boolean)
.setAutoTuneConfig
(AutoTuneConfig autoTuneConfig) Deprecated.migrate toautoTuneConfig(AutoTuneConfig)
.setBackgroundExecutorSchedulePoolSize
(int backgroundExecutorSchedulePoolSize) Deprecated.migrate tobackgroundExecutorSchedulePoolSize(int)
.setBackgroundExecutorShutdownSecs
(int backgroundExecutorShutdownSecs) Deprecated.migrate tobackgroundExecutorShutdownSecs(int)
.setBackgroundExecutorWrapper
(BackgroundExecutorWrapper backgroundExecutorWrapper) Deprecated.setCacheMaxIdleTime
(int cacheMaxIdleTime) Deprecated.migrate tocacheMaxIdleTime(int)
.setCacheMaxSize
(int cacheMaxSize) Deprecated.migrate tocacheMaxSize(int)
.setCacheMaxTimeToLive
(int cacheMaxTimeToLive) Deprecated.migrate tocacheMaxTimeToLive(int)
.setChangeLogAsync
(boolean changeLogAsync) Deprecated.migrate tochangeLogAsync(boolean)
.setChangeLogIncludeInserts
(boolean changeLogIncludeInserts) Deprecated.migrate tochangeLogIncludeInserts(boolean)
.setChangeLogListener
(ChangeLogListener changeLogListener) Deprecated.migrate tochangeLogListener(ChangeLogListener)
.setChangeLogPrepare
(ChangeLogPrepare changeLogPrepare) Deprecated.migrate tochangeLogPrepare(ChangeLogPrepare)
.setChangeLogRegister
(ChangeLogRegister changeLogRegister) Deprecated.migrate tochangeLogRegister(ChangeLogRegister)
.setClassLoadConfig
(ClassLoadConfig classLoadConfig) Deprecated.migrate toclassLoadConfig(ClassLoadConfig)
.Deprecated.migrate toclock(Clock)
.setConstraintNaming
(DbConstraintNaming constraintNaming) Deprecated.migrate toconstraintNaming(DbConstraintNaming)
.setContainerConfig
(ContainerConfig containerConfig) Deprecated.migrate tocontainerConfig(ContainerConfig)
.setCurrentTenantProvider
(CurrentTenantProvider currentTenantProvider) Deprecated.migrate tocurrentTenantProvider(CurrentTenantProvider)
.setCurrentUserProvider
(CurrentUserProvider currentUserProvider) Deprecated.migrate tocurrentUserProvider(CurrentUserProvider)
.setDatabaseBooleanFalse
(String databaseFalse) Deprecated.migrate todatabaseBooleanFalse(String)
.setDatabaseBooleanTrue
(String databaseTrue) Deprecated.migrate todatabaseBooleanTrue(String)
.setDatabasePlatform
(DatabasePlatform databasePlatform) Deprecated.migrate todatabasePlatform(DatabasePlatform)
.setDatabasePlatformName
(String databasePlatformName) Deprecated.migrate todatabasePlatformName(String)
.setDatabaseSequenceBatch
(int databaseSequenceBatchSize) Deprecated.migrate todatabaseSequenceBatch(int)
.setDatabaseSequenceBatchSize
(int databaseSequenceBatchSize) Deprecated.migrate todatabaseSequenceBatchSize(int)
.setDataSource
(DataSource dataSource) Deprecated.migrate todataSource(DataSource)
.setDataSourceConfig
(io.ebean.datasource.DataSourceBuilder dataSourceConfig) Deprecated.migrate todataSourceBuilder(DataSourceBuilder)
.setDataTimeZone
(String dataTimeZone) Deprecated.migrate todataTimeZone(String)
.setDbEncrypt
(DbEncrypt dbEncrypt) Deprecated.migrate todbEncrypt(DbEncrypt)
.setDbOffline
(boolean dbOffline) Deprecated.migrate tooffline(boolean)
.setDbSchema
(String dbSchema) Deprecated.migrate tosetDbSchema(String)
setDbUuid
(PlatformConfig.DbUuid dbUuid) Deprecated.migrate todbUuid(PlatformConfig.DbUuid)
.setDdlCreateOnly
(boolean ddlCreateOnly) Deprecated.migrate toddlCreateOnly(boolean)
.setDdlExtra
(boolean ddlExtra) Deprecated.migrate toddlExtra(boolean)
.setDdlGenerate
(boolean ddlGenerate) Deprecated.migrate toddlGenerate(boolean)
.setDdlHeader
(String ddlHeader) Deprecated.migrate toddlHeader(String)
.setDdlInitSql
(String ddlInitSql) Deprecated.migrate toddlInitSql(String)
.setDdlPlaceholderMap
(Map<String, String> ddlPlaceholderMap) Deprecated.migrate toddlPlaceholderMap(Map)
.setDdlPlaceholders
(String ddlPlaceholders) Deprecated.migrate toddlPlaceholders(String)
.setDdlRun
(boolean ddlRun) Deprecated.migrate toddlRun(boolean)
.setDdlSeedSql
(String ddlSeedSql) Deprecated.migrate toddlSeedSql(String)
.setDdlStrictMode
(boolean ddlStrictMode) Deprecated.migrate toddlStrictMode(boolean)
.setDefaultEnumType
(jakarta.persistence.EnumType defaultEnumType) Deprecated.migrate todefaultEnumType(EnumType)
.setDefaultServer
(boolean defaultServer) Deprecated.migrate todefaultDatabase(boolean)
.setDisableClasspathSearch
(boolean disableClasspathSearch) Deprecated.migrate todisableClasspathSearch(boolean)
.setDisableL2Cache
(boolean disableL2Cache) Deprecated.migrate todisableL2Cache(boolean)
.setDisableLazyLoading
(boolean disableLazyLoading) Deprecated.migrate todisableLazyLoading(boolean)
.setDumpMetricsOnShutdown
(boolean dumpMetricsOnShutdown) Deprecated.migrate todumpMetricsOnShutdown(boolean)
.setDumpMetricsOptions
(String dumpMetricsOptions) Deprecated.migrate todumpMetricsOptions(String)
.setDurationWithNanos
(boolean durationWithNanos) Deprecated.migrate todurationWithNanos(boolean)
.setEagerFetchLobs
(boolean eagerFetchLobs) Deprecated.migrate toeagerFetchLobs(boolean)
.setEnabledL2Regions
(String enabledL2Regions) Deprecated.migrate toenabledL2Regions(String)
.setEncryptDeployManager
(EncryptDeployManager encryptDeployManager) Deprecated.migrate toencryptDeployManager(EncryptDeployManager)
.setEncryptKeyManager
(EncryptKeyManager encryptKeyManager) Deprecated.migrate toencryptKeyManager(EncryptKeyManager)
.setEncryptor
(Encryptor encryptor) Deprecated.migrate toencryptor(Encryptor)
.setExpressionEqualsWithNullAsNoop
(boolean expressionEqualsWithNullAsNoop) Deprecated.migrate toexpressionEqualsWithNullAsNoop(boolean)
.setExpressionNativeIlike
(boolean expressionNativeIlike) Deprecated.migrate toexpressionNativeIlike(boolean)
.setExternalTransactionManager
(ExternalTransactionManager externalTransactionManager) Deprecated.setFindControllers
(List<BeanFindController> findControllers) Set the list of BeanFindController instances.setGeometrySRID
(int geometrySRID) Deprecated.migrate togeometrySRID(int)
.setHistoryTableSuffix
(String historyTableSuffix) Deprecated.migrate tohistoryTableSuffix(String)
.setIdGeneratorAutomatic
(boolean idGeneratorAutomatic) Deprecated.migrate toidGeneratorAutomatic(boolean)
.setIdGenerators
(List<IdGenerator> idGenerators) Set the custom IdGenerator instances.Deprecated.migrate toidType(IdType)
.setJdbcFetchSizeFindEach
(int jdbcFetchSizeFindEach) Deprecated.migrate tojdbcFetchSizeFindEach(int)
.setJdbcFetchSizeFindList
(int jdbcFetchSizeFindList) Deprecated.migrate tojdbcFetchSizeFindList(int)
.setJodaLocalTimeMode
(String jodaLocalTimeMode) Deprecated.migrate tojodaLocalTimeMode(String)
.setJsonDate
(JsonConfig.Date jsonDate) Deprecated.migrate tojsonDateTime(JsonConfig.DateTime)
.setJsonDateTime
(JsonConfig.DateTime jsonDateTime) Deprecated.migrate tojsonDateTime(JsonConfig.DateTime)
.setJsonFactory
(com.fasterxml.jackson.core.JsonFactory jsonFactory) Deprecated.migrate tojsonFactory(JsonFactory)
.setJsonInclude
(JsonConfig.Include jsonInclude) Deprecated.migrate tojsonInclude(JsonConfig.Include)
.setJsonMutationDetection
(io.ebean.annotation.MutationDetection jsonMutationDetection) Deprecated.migrate tojsonMutationDetection(MutationDetection)
.setLazyLoadBatchSize
(int lazyLoadBatchSize) Deprecated.migrate tolazyLoadBatchSize(int)
.setLoadModuleInfo
(boolean loadModuleInfo) Deprecated.migrate toloadModuleInfo(boolean)
.setLocalOnlyL2Cache
(boolean localOnlyL2Cache) Deprecated.migrate tolocalOnlyL2Cache(boolean)
.setLocalTimeWithNanos
(boolean localTimeWithNanos) Deprecated.migrate tolocalTimeWithNanos(boolean)
.setMappingLocations
(List<String> mappingLocations) Deprecated.migrate tomappingLocations(List)
.setMaxCallStack
(int maxCallStack) Deprecated.migrate tomaxCallStack(int)
.setMetricNaming
(Function<String, String> metricNaming) Deprecated.migrate tometricNaming(Function)
.Deprecated.migrate toname(String)
.setNamingConvention
(NamingConvention namingConvention) Deprecated.migrate tonamingConvention(NamingConvention)
.setNotifyL2CacheInForeground
(boolean notifyL2CacheInForeground) Deprecated.migrate tonotifyL2CacheInForeground(boolean)
.setObjectMapper
(Object objectMapper) Deprecated.migrate toobjectMapper(Object)
.setPackages
(List<String> packages) Set packages to search for entities via class path search.setPersistBatch
(io.ebean.annotation.PersistBatch persistBatch) Deprecated.migrate topersistBatch(PersistBatch)
.setPersistBatching
(boolean persistBatching) Deprecated.migrate topersistBatching(boolean)
.setPersistBatchOnCascade
(io.ebean.annotation.PersistBatch persistBatchOnCascade) Deprecated.migrate topersistBatchOnCascade(PersistBatch)
.setPersistBatchSize
(int persistBatchSize) Deprecated.migrate topersistBatchSize(int)
.setPersistControllers
(List<BeanPersistController> persistControllers) Register all the BeanPersistController instances.setPersistenceContextScope
(PersistenceContextScope persistenceContextScope) Deprecated.migrate topersistenceContextScope(PersistenceContextScope)
.setPersistListeners
(List<BeanPersistListener> persistListeners) Register all the BeanPersistListener instances.setPlatformConfig
(PlatformConfig platformConfig) Deprecated.migrate toplatformConfig(PlatformConfig)
.setPostConstructListeners
(List<BeanPostConstructListener> listeners) Set the list of BeanPostLoader instances.setPostLoaders
(List<BeanPostLoad> postLoaders) Set the list of BeanPostLoader instances.setProfilingConfig
(ProfilingConfig profilingConfig) Deprecated.migrate toprofilingConfig(ProfilingConfig)
.setQueryAdapters
(List<BeanQueryAdapter> queryAdapters) Register all the BeanQueryAdapter instances.setQueryBatchSize
(int queryBatchSize) Deprecated.migrate toqueryBatchSize(int)
.setQueryCacheMaxIdleTime
(int queryCacheMaxIdleTime) Deprecated.migrate toqueryCacheMaxIdleTime(int)
.setQueryCacheMaxSize
(int queryCacheMaxSize) Deprecated.migrate toqueryCacheMaxSize(int)
.setQueryCacheMaxTimeToLive
(int queryCacheMaxTimeToLive) Deprecated.migrate toqueryCacheMaxTimeToLive(int)
.setQueryPlanCapture
(boolean queryPlanCapture) Deprecated.migrate toqueryPlanCapture(boolean)
.setQueryPlanCaptureMaxCount
(int queryPlanCaptureMaxCount) Deprecated.migrate toqueryPlanCaptureMaxCount(int)
.setQueryPlanCaptureMaxTimeMillis
(long queryPlanCaptureMaxTimeMillis) Deprecated.migrate toqueryPlanCaptureMaxTimeMillis(long)
.setQueryPlanCapturePeriodSecs
(long queryPlanCapturePeriodSecs) Deprecated.migrate toqueryPlanCapturePeriodSecs(long)
.setQueryPlanEnable
(boolean queryPlanEnable) Deprecated.migrate toqueryPlanEnable(boolean)
.setQueryPlanListener
(QueryPlanListener queryPlanListener) Deprecated.migrate toqueryPlanListener(QueryPlanListener)
.setQueryPlanThresholdMicros
(long queryPlanThresholdMicros) Deprecated.migrate toqueryPlanThresholdMicros(long)
.setQueryPlanTTLSeconds
(int queryPlanTTLSeconds) Deprecated.migrate toqueryPlanTTLSeconds(int)
.setReadOnlyDataSource
(DataSource readOnlyDataSource) Deprecated.migrate toreadOnlyDataSource(DataSource)
.setReadOnlyDataSourceConfig
(io.ebean.datasource.DataSourceBuilder readOnlyDataSourceConfig) Deprecated.migrate toreadOnlyDataSourceBuilder(DataSourceBuilder)
.setRegister
(boolean register) Deprecated.migrate toregister(boolean)
.setResourceDirectory
(String resourceDirectory) Deprecated.migrate toresourceDirectory(String)
.setRunMigration
(boolean runMigration) Deprecated.migrate torunMigration(boolean)
.setServerCachePlugin
(ServerCachePlugin serverCachePlugin) Deprecated.migrate toserverCachePlugin(ServerCachePlugin)
.setSkipCacheAfterWrite
(boolean skipCacheAfterWrite) Deprecated.migrate toskipCacheAfterWrite(boolean)
.setSkipDataSourceCheck
(boolean skipDataSourceCheck) Deprecated.migrate toskipDataSourceCheck(boolean)
.setSlowQueryListener
(SlowQueryListener slowQueryListener) Deprecated.migrate toslowQueryListener(SlowQueryListener)
.setSlowQueryMillis
(long slowQueryMillis) Deprecated.migrate toslowQueryMillis(long)
.setTenantCatalogProvider
(TenantCatalogProvider tenantCatalogProvider) Deprecated.migrate totenantCatalogProvider(TenantCatalogProvider)
.setTenantDataSourceProvider
(TenantDataSourceProvider tenantDataSourceProvider) Deprecated.setTenantMode
(TenantMode tenantMode) Deprecated.migrate totenantMode(TenantMode)
.setTenantPartitionColumn
(String tenantPartitionColumn) Deprecated.migrate totenantPartitionColumn(String)
.setTenantSchemaProvider
(TenantSchemaProvider tenantSchemaProvider) Deprecated.migrate totenantSchemaProvider(TenantSchemaProvider)
.settings()
Return the settings to read the configuration that has been set.setTransactionRollbackOnChecked
(boolean transactionRollbackOnChecked) Deprecated.migrate totransactionRollbackOnChecked(boolean)
.setUpdateAllPropertiesInBatch
(boolean updateAllPropertiesInBatch) Deprecated.migrate toupdateAllPropertiesInBatch(boolean)
.setUseJtaTransactionManager
(boolean useJtaTransactionManager) Deprecated.migrate touseJtaTransactionManager(boolean)
.setUseValidationNotNull
(boolean useValidationNotNull) Deprecated.migrate touseValidationNotNull(boolean)
.setUuidNodeId
(String uuidNodeId) Deprecated.migrate touuidNodeId(String)
.setUuidStateFile
(String uuidStateFile) Deprecated.migrate touuidStateFile(String)
.setUuidVersion
(DatabaseConfig.UuidVersion uuidVersion) Deprecated.migrate touuidVersion(DatabaseConfig.UuidVersion)
.default DatabaseBuilder
skipCacheAfterWrite
(boolean skipCacheAfterWrite) Set to false when we still want to hit the cache after a write has occurred on a transaction.default DatabaseBuilder
skipDataSourceCheck
(boolean skipDataSourceCheck) Set to true to skip the startup DataSource check.default DatabaseBuilder
slowQueryListener
(SlowQueryListener slowQueryListener) Set the slow query event listener.default DatabaseBuilder
slowQueryMillis
(long slowQueryMillis) Set the slow query time in millis.default DatabaseBuilder
tenantCatalogProvider
(TenantCatalogProvider tenantCatalogProvider) Set the tenancy catalog provider.default DatabaseBuilder
tenantDataSourceProvider
(TenantDataSourceProvider tenantDataSourceProvider) Set the tenancy datasource provider.default DatabaseBuilder
tenantMode
(TenantMode tenantMode) Set the tenancy mode to use.default DatabaseBuilder
tenantPartitionColumn
(String tenantPartitionColumn) Set the column name used for TenantMode.PARTITION.default DatabaseBuilder
tenantSchemaProvider
(TenantSchemaProvider tenantSchemaProvider) Set the tenancy schema provider.default DatabaseBuilder
transactionRollbackOnChecked
(boolean transactionRollbackOnChecked) Set to true if transactions should by default rollback on checked exceptions.default DatabaseBuilder
updateAllPropertiesInBatch
(boolean updateAllPropertiesInBatch) Set to false if by default updates in JDBC batch should not include all properties.default DatabaseBuilder
useJtaTransactionManager
(boolean useJtaTransactionManager) Set to true if we are running in a JTA Transaction manager.default DatabaseBuilder
useValidationNotNull
(boolean useValidationNotNull) Controls if Ebean should ignore&x64;javax.validation.contstraints.NotNull
or&x64;jakarta.validation.contstraints.NotNull
with respect to generating aNOT NULL
column.default DatabaseBuilder
uuidNodeId
(String uuidNodeId) Sets the V1-UUID-NodeId.default DatabaseBuilder
uuidStateFile
(String uuidStateFile) Set the UUID state file.default DatabaseBuilder
uuidVersion
(DatabaseConfig.UuidVersion uuidVersion) Sets the UUID version mode.
-
Method Details
-
build
Database build()Build and return the Database instance. -
settings
DatabaseBuilder.Settings settings()Return the settings to read the configuration that has been set. This provides the getters/accessors to read the configuration properties. -
apply
Apply configuration to this builder using a lambda. -
alsoIf
Conditionally apply configuration to this builder via a lambda.- Parameters:
predicate
- The condition to apply configuration when true.apply
- The configuration to apply to this builder.
-
name
Set the name of the Database. -
setName
Deprecated.migrate toname(String)
. -
register
Set to false if you do not want this server to be registered with the Ebean singleton when it is created.By default, this is set to true.
-
setRegister
Deprecated.migrate toregister(boolean)
. -
defaultDatabase
Set false if you do not want this Database to be registered as the "default" database with the DB singleton.This is only used when
setRegister(boolean)
is also true. -
setDefaultServer
Deprecated.migrate todefaultDatabase(boolean)
. -
dbSchema
Set the DB schema to use. This specifies to use this schema for:- Running Database migrations - Create and use the DB schema
- Testing DDL - Create-all.sql DDL execution creates and uses schema
- Testing Docker - Set default schema on connection URL
-
setDbSchema
Deprecated.migrate tosetDbSchema(String)
-
geometrySRID
Set the Geometry SRID. -
setGeometrySRID
Deprecated.migrate togeometrySRID(int)
. -
dataTimeZone
Set the time zone to use when reading/writing Timestamps via JDBC. -
setDataTimeZone
Deprecated.migrate todataTimeZone(String)
. -
persistBatch
Set the JDBC batch mode to use 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.
-
setPersistBatch
Deprecated.migrate topersistBatch(PersistBatch)
. -
persistBatchOnCascade
default DatabaseBuilder persistBatchOnCascade(io.ebean.annotation.PersistBatch persistBatchOnCascade) Set the JDBC batch mode to use per save(), delete(), insert() or update() request.This makes sense when a save() or delete() etc cascades and executes multiple child statements. The best caase 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.
-
setPersistBatchOnCascade
@Deprecated DatabaseBuilder setPersistBatchOnCascade(io.ebean.annotation.PersistBatch persistBatchOnCascade) Deprecated.migrate topersistBatchOnCascade(PersistBatch)
. -
persistBatching
Deprecated, please migrate to using setPersistBatch().Set to true if you what to use JDBC batching for persisting and deleting beans.
With this Ebean will batch up persist requests and use the JDBC batch api. This is a performance optimisation designed to reduce the network chatter.
When true this is equivalent to
setPersistBatch(PersistBatch.ALL)
or when false tosetPersistBatch(PersistBatch.NONE)
-
setPersistBatching
Deprecated.migrate topersistBatching(boolean)
. -
persistBatchSize
Set the batch size used for JDBC batching. If unset this defaults to 20.You can also set the batch size on the transaction.
- See Also:
-
setPersistBatchSize
Deprecated.migrate topersistBatchSize(int)
. -
disableLazyLoading
Set to true to disable lazy loading by default.It can be turned on per query via
QueryBuilder.setDisableLazyLoading(boolean)
. -
setDisableLazyLoading
Deprecated.migrate todisableLazyLoading(boolean)
. -
lazyLoadBatchSize
Set the default batch size for lazy loading.This is the number of beans or collections loaded when lazy loading is invoked by default.
The default value is for this is 10 (load 10 beans or collections).
You can explicitly control the lazy loading batch size for a given join on a query using +lazy(batchSize) or JoinConfig.
-
setLazyLoadBatchSize
Deprecated.migrate tolazyLoadBatchSize(int)
. -
clock
Set the clock used for setting the timestamps (e.g. @UpdatedTimestamp) on objects. -
setClock
Deprecated.migrate toclock(Clock)
. -
slowQueryMillis
Set the slow query time in millis. -
setSlowQueryMillis
Deprecated.migrate toslowQueryMillis(long)
. -
slowQueryListener
Set the slow query event listener. -
setSlowQueryListener
Deprecated.migrate toslowQueryListener(SlowQueryListener)
. -
putServiceObject
Put a service object into configuration such that it can be used by ebean or a plugin.For example, put IgniteConfiguration in to be passed to the Ignite plugin.
-
putServiceObject
Put a service object into configuration such that it can be used by ebean or a plugin.For example, put IgniteConfiguration in to be passed to the Ignite plugin. You can also override some SPI objects that should be used for that Database. Currently, the following objects are possible.
- DataSourceAlertFactory (e.g. add different alert factories for different ebean instances)
- DocStoreFactory
- SlowQueryListener (e.g. add custom query listener for a certain ebean instance)
- ServerCacheNotifyPlugin
-
putServiceObject
Put a service object into configuration such that it can be used by ebean or a plugin.JedisPool jedisPool = .. config.putServiceObject(jedisPool);
-
jsonFactory
Set the Jackson JsonFactory to use.If not set a default implementation will be used.
-
setJsonFactory
Deprecated.migrate tojsonFactory(JsonFactory)
. -
jsonDateTime
Set the JSON format to use for DateTime types. -
setJsonDateTime
Deprecated.migrate tojsonDateTime(JsonConfig.DateTime)
. -
jsonDate
Set the JSON format to use for Date types. -
setJsonDate
Deprecated.migrate tojsonDateTime(JsonConfig.DateTime)
. -
jsonInclude
Set the JSON include mode used when writing JSON.Set to NON_NULL or NON_EMPTY to suppress nulls or null and empty collections respectively.
-
setJsonInclude
Deprecated.migrate tojsonInclude(JsonConfig.Include)
. -
jsonMutationDetection
default DatabaseBuilder jsonMutationDetection(io.ebean.annotation.MutationDetection jsonMutationDetection) Set the default MutableDetection to use with@DbJson
using Jackson.- See Also:
-
setJsonMutationDetection
@Deprecated DatabaseBuilder setJsonMutationDetection(io.ebean.annotation.MutationDetection jsonMutationDetection) Deprecated.migrate tojsonMutationDetection(MutationDetection)
. -
containerConfig
Set the container / clustering configuration. The container holds all the Database instances and provides clustering communication services to all the Database instances. -
setContainerConfig
Deprecated.migrate tocontainerConfig(ContainerConfig)
. -
currentUserProvider
Set the CurrentUserProvider. This is used to populate @WhoCreated, @WhoModified and support other audit features (who executed a query etc). -
setCurrentUserProvider
Deprecated.migrate tocurrentUserProvider(CurrentUserProvider)
. -
tenantMode
Set the tenancy mode to use. -
setTenantMode
Deprecated.migrate totenantMode(TenantMode)
. -
tenantPartitionColumn
Set the column name used for TenantMode.PARTITION. -
setTenantPartitionColumn
Deprecated.migrate totenantPartitionColumn(String)
. -
currentTenantProvider
Set the current tenant provider. -
setCurrentTenantProvider
Deprecated.migrate tocurrentTenantProvider(CurrentTenantProvider)
. -
tenantDataSourceProvider
Set the tenancy datasource provider. -
setTenantDataSourceProvider
@Deprecated DatabaseBuilder setTenantDataSourceProvider(TenantDataSourceProvider tenantDataSourceProvider) Deprecated. -
tenantSchemaProvider
Set the tenancy schema provider. -
setTenantSchemaProvider
Deprecated.migrate totenantSchemaProvider(TenantSchemaProvider)
. -
tenantCatalogProvider
Set the tenancy catalog provider. -
setTenantCatalogProvider
Deprecated.migrate totenantCatalogProvider(TenantCatalogProvider)
. -
autoPersistUpdates
Set to true if dirty beans are automatically persisted. -
setAutoPersistUpdates
Deprecated.migrate toautoPersistUpdates(boolean)
. -
queryBatchSize
Sets the query batch size. This defaults to 100.- Parameters:
queryBatchSize
- the new query batch size
-
setQueryBatchSize
Deprecated.migrate toqueryBatchSize(int)
. -
defaultEnumType
Set the default mapping for enum type. -
setDefaultEnumType
Deprecated.migrate todefaultEnumType(EnumType)
. -
databaseSequenceBatchSize
Set the number of sequences to fetch/preallocate when using DB sequences.This is a performance optimisation to reduce the number times Ebean requests a sequence to be used as an Id for a bean (aka reduce network chatter).
-
setDatabaseSequenceBatchSize
Deprecated.migrate todatabaseSequenceBatchSize(int)
. -
jdbcFetchSizeFindList
Set the default JDBC fetchSize hint for findList queries. -
setJdbcFetchSizeFindList
Deprecated.migrate tojdbcFetchSizeFindList(int)
. -
jdbcFetchSizeFindEach
Set the default JDBC fetchSize hint for findEach/findEachWhile queries. -
setJdbcFetchSizeFindEach
Deprecated.migrate tojdbcFetchSizeFindEach(int)
. -
changeLogPrepare
Set 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.
-
setChangeLogPrepare
Deprecated.migrate tochangeLogPrepare(ChangeLogPrepare)
. -
changeLogListener
Set the ChangeLogListener which actually performs the logging of change sets in the background. -
setChangeLogListener
Deprecated.migrate tochangeLogListener(ChangeLogListener)
. -
changeLogRegister
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 are included in the change log. -
setChangeLogRegister
Deprecated.migrate tochangeLogRegister(ChangeLogRegister)
. -
changeLogIncludeInserts
Set if inserts should be included in the change log by default. -
setChangeLogIncludeInserts
Deprecated.migrate tochangeLogIncludeInserts(boolean)
. -
changeLogAsync
Sets if the changelog should be written async (default = true). -
setChangeLogAsync
Deprecated.migrate tochangeLogAsync(boolean)
. -
profilingConfig
Set the configuration for profiling. -
setProfilingConfig
Deprecated.migrate toprofilingConfig(ProfilingConfig)
. -
asOfViewSuffix
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. -
setAsOfViewSuffix
Deprecated.migrate toasOfViewSuffix(String)
. -
asOfSysPeriod
Set the database column used to support history and 'As of' queries. This column is a timestamp range or equivalent. -
setAsOfSysPeriod
Deprecated.migrate toasOfSysPeriod(String)
. -
historyTableSuffix
Set the history table suffix. -
setHistoryTableSuffix
Deprecated.migrate tohistoryTableSuffix(String)
. -
useJtaTransactionManager
Set to true if we are running in a JTA Transaction manager. -
setUseJtaTransactionManager
Deprecated.migrate touseJtaTransactionManager(boolean)
. -
externalTransactionManager
default DatabaseBuilder externalTransactionManager(ExternalTransactionManager externalTransactionManager) Set the external transaction manager. -
setExternalTransactionManager
@Deprecated DatabaseBuilder setExternalTransactionManager(ExternalTransactionManager externalTransactionManager) Deprecated. -
serverCachePlugin
Set the ServerCachePlugin to use. -
setServerCachePlugin
Deprecated.migrate toserverCachePlugin(ServerCachePlugin)
. -
eagerFetchLobs
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. -
setEagerFetchLobs
Deprecated.migrate toeagerFetchLobs(boolean)
. -
maxCallStack
Set the max call stack to use for origin location. -
setMaxCallStack
Deprecated.migrate tomaxCallStack(int)
. -
transactionRollbackOnChecked
Set to true if transactions should by default rollback on checked exceptions. -
setTransactionRollbackOnChecked
Deprecated.migrate totransactionRollbackOnChecked(boolean)
. -
backgroundExecutorSchedulePoolSize
Set the Background executor schedule pool size. -
setBackgroundExecutorSchedulePoolSize
@Deprecated DatabaseBuilder setBackgroundExecutorSchedulePoolSize(int backgroundExecutorSchedulePoolSize) Deprecated.migrate tobackgroundExecutorSchedulePoolSize(int)
. -
backgroundExecutorShutdownSecs
Set the Background executor shutdown seconds. This is the time allowed for the pool to shutdown nicely before it is forced shutdown. -
setBackgroundExecutorShutdownSecs
Deprecated.migrate tobackgroundExecutorShutdownSecs(int)
. -
backgroundExecutorWrapper
default DatabaseBuilder backgroundExecutorWrapper(BackgroundExecutorWrapper backgroundExecutorWrapper) Sets the background executor wrapper. The wrapper is used when a task is sent to background and should copy the thread-locals. -
setBackgroundExecutorWrapper
@Deprecated DatabaseBuilder setBackgroundExecutorWrapper(BackgroundExecutorWrapper backgroundExecutorWrapper) Deprecated. -
cacheMaxSize
Set the L2 cache default max size. -
setCacheMaxSize
Deprecated.migrate tocacheMaxSize(int)
. -
cacheMaxIdleTime
Set the L2 cache default max idle time in seconds. -
setCacheMaxIdleTime
Deprecated.migrate tocacheMaxIdleTime(int)
. -
cacheMaxTimeToLive
Set the L2 cache default max time to live in seconds. -
setCacheMaxTimeToLive
Deprecated.migrate tocacheMaxTimeToLive(int)
. -
queryCacheMaxSize
Set the L2 query cache default max size. -
setQueryCacheMaxSize
Deprecated.migrate toqueryCacheMaxSize(int)
. -
queryCacheMaxIdleTime
Set the L2 query cache default max idle time in seconds. -
setQueryCacheMaxIdleTime
Deprecated.migrate toqueryCacheMaxIdleTime(int)
. -
queryCacheMaxTimeToLive
Set the L2 query cache default max time to live in seconds. -
setQueryCacheMaxTimeToLive
Deprecated.migrate toqueryCacheMaxTimeToLive(int)
. -
namingConvention
Set the NamingConvention.If none is set the default UnderscoreNamingConvention is used.
-
setNamingConvention
Deprecated.migrate tonamingConvention(NamingConvention)
. -
allQuotedIdentifiers
Set to true if all DB column and table names should use quoted identifiers.For Postgres pgjdbc version 42.3.0 should be used with datasource property quoteReturningIdentifiers set to false (refer #2303).
-
setAllQuotedIdentifiers
Deprecated.migrate toallQuotedIdentifiers(boolean)
. -
constraintNaming
Set the constraint naming convention used in DDL generation. -
setConstraintNaming
Deprecated.migrate toconstraintNaming(DbConstraintNaming)
. -
autoTuneConfig
Set the configuration for AutoTune. -
setAutoTuneConfig
Deprecated.migrate toautoTuneConfig(AutoTuneConfig)
. -
skipDataSourceCheck
Set to true to skip the startup DataSource check. -
setSkipDataSourceCheck
Deprecated.migrate toskipDataSourceCheck(boolean)
. -
readOnlyDatabase
Set to 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.
-
dataSource
Set a DataSource. -
setDataSource
Deprecated.migrate todataSource(DataSource)
. -
readOnlyDataSource
Set the read only DataSource.Note that the DataSource is expected to use AutoCommit true mode avoiding the need for explicit commit (or rollback).
This read only DataSource will be used for implicit query only transactions. It is not used if the transaction is created explicitly or if the query is an update or delete query.
-
setReadOnlyDataSource
Deprecated.migrate toreadOnlyDataSource(DataSource)
. -
dataSourceBuilder
Set the configuration required to build a DataSource using Ebean's own DataSource implementation. -
setDataSourceConfig
@Deprecated DatabaseBuilder setDataSourceConfig(io.ebean.datasource.DataSourceBuilder dataSourceConfig) Deprecated.migrate todataSourceBuilder(DataSourceBuilder)
. -
autoReadOnlyDataSource
Set to true if Ebean should create a DataSource for use with implicit read only transactions. -
setAutoReadOnlyDataSource
Deprecated.migrate toautoReadOnlyDataSource(boolean)
. -
readOnlyDataSourceBuilder
default DatabaseBuilder readOnlyDataSourceBuilder(io.ebean.datasource.DataSourceBuilder readOnlyDataSourceConfig) Set the configuration for the read only DataSource. -
setReadOnlyDataSourceConfig
@Deprecated DatabaseBuilder setReadOnlyDataSourceConfig(io.ebean.datasource.DataSourceBuilder readOnlyDataSourceConfig) Deprecated.migrate toreadOnlyDataSourceBuilder(DataSourceBuilder)
. -
databaseBooleanTrue
Set the value to represent TRUE in the database.This is used for databases that do not support boolean natively.
The value set is either a Integer or a String (e.g. "1", or "T").
-
setDatabaseBooleanTrue
Deprecated.migrate todatabaseBooleanTrue(String)
. -
databaseBooleanFalse
Set the value to represent FALSE in the database.This is used for databases that do not support boolean natively.
The value set is either a Integer or a String (e.g. "0", or "F").
-
setDatabaseBooleanFalse
Deprecated.migrate todatabaseBooleanFalse(String)
. -
databaseSequenceBatch
Set the number of DB sequence values that should be preallocated and cached by Ebean.This is only used for DB's that use sequences and is a performance optimisation. This reduces the number of times Ebean needs to get a sequence value from the Database reducing network chatter.
By default this value is 10 so when we need another Id (and don't have one in our cache) Ebean will fetch 10 id's from the database. Note that when the cache drops to have full (which is 5 by default) Ebean will fetch another batch of Id's in a background thread.
-
setDatabaseSequenceBatch
Deprecated.migrate todatabaseSequenceBatch(int)
. -
databasePlatformName
Explicitly set the database platform nameIf none is set then the platform is determined automatically via the JDBC driver information.
This can be used when the Database Platform can not be automatically detected from the JDBC driver (possibly 3rd party JDBC driver). It is also useful when you want to do offline DDL generation for a database platform that you don't have access to.
Values are oracle, h2, postgres, mysql, sqlserver16, sqlserver17.
-
setDatabasePlatformName
Deprecated.migrate todatabasePlatformName(String)
. -
databasePlatform
Explicitly set the database platform to use.If none is set then the platform is determined via the databasePlatformName or automatically via the JDBC driver information.
-
setDatabasePlatform
Deprecated.migrate todatabasePlatform(DatabasePlatform)
. -
idType
Set the preferred DB platform IdType. -
setIdType
Deprecated.migrate toidType(IdType)
. -
encryptKeyManager
Set the EncryptKeyManager.This is required when you want to use encrypted properties.
You can also set this in ebean.proprerties:
# set via ebean.properties ebean.encryptKeyManager=org.avaje.tests.basic.encrypt.BasicEncyptKeyManager
-
setEncryptKeyManager
Deprecated.migrate toencryptKeyManager(EncryptKeyManager)
. -
encryptDeployManager
Set the EncryptDeployManager.This is optionally used to programmatically define which columns are encrypted instead of using the
Encrypted
Annotation. -
setEncryptDeployManager
Deprecated.migrate toencryptDeployManager(EncryptDeployManager)
. -
encryptor
Set the Encryptor used to encrypt data on the java client side (as opposed to DB encryption functions).Ebean has a default implementation that it will use if you do not set your own Encryptor implementation.
-
setEncryptor
Deprecated.migrate toencryptor(Encryptor)
. -
offline
Set to true if the Database instance should be created in offline mode.Typically used to create an Database instance for DDL Migration generation without requiring a real DataSource / Database to connect to.
-
setDbOffline
Deprecated.migrate tooffline(boolean)
. -
dbEncrypt
Set the DbEncrypt used to encrypt and decrypt properties.Note that if this is not set then the DbPlatform may already have a DbEncrypt set (H2, MySql, Postgres and Oracle platforms have a DbEncrypt)
-
setDbEncrypt
Deprecated.migrate todbEncrypt(DbEncrypt)
. -
platformConfig
Set the configuration for DB platform (such as UUID and custom mappings). -
setPlatformConfig
Deprecated.migrate toplatformConfig(PlatformConfig)
. -
dbUuid
Set the DB type used to store UUID. -
setDbUuid
Deprecated.migrate todbUuid(PlatformConfig.DbUuid)
. -
uuidVersion
Sets the UUID version mode. -
setUuidVersion
Deprecated.migrate touuidVersion(DatabaseConfig.UuidVersion)
. -
uuidStateFile
Set the UUID state file. -
setUuidStateFile
Deprecated.migrate touuidStateFile(String)
. -
uuidNodeId
Sets the V1-UUID-NodeId. -
setUuidNodeId
Deprecated.migrate touuidNodeId(String)
. -
localTimeWithNanos
Set to true if LocalTime should be persisted with nanos precision.Otherwise it is persisted using java.sql.Time which is seconds precision.
-
setLocalTimeWithNanos
Deprecated.migrate tolocalTimeWithNanos(boolean)
. -
durationWithNanos
Set to true if Duration should be persisted with nanos precision (SQL DECIMAL).Otherwise it is persisted with second precision (SQL INTEGER).
-
setDurationWithNanos
Deprecated.migrate todurationWithNanos(boolean)
. -
runMigration
Set to true to run DB migrations on server start.This is the same as config.getMigrationConfig().setRunMigration(). We have added this method here as it is often the only thing we need to configure for migrations.
-
setRunMigration
Deprecated.migrate torunMigration(boolean)
. -
ddlGenerate
Set to true to generate the "create all" DDL on startup.Typically we want this on when we are running tests locally (and often using H2) and we want to create the full DB schema from scratch to run tests.
-
setDdlGenerate
Deprecated.migrate toddlGenerate(boolean)
. -
ddlRun
Set to true to run the generated "create all DDL" on startup.Typically we want this on when we are running tests locally (and often using H2) and we want to create the full DB schema from scratch to run tests.
-
setDdlRun
Deprecated.migrate toddlRun(boolean)
. -
ddlExtra
Set to false if you not want to run the extra-ddl.xml scripts. (default = true)Typically we want this on when we are running tests.
-
setDdlExtra
Deprecated.migrate toddlExtra(boolean)
. -
ddlCreateOnly
Set to 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.
-
setDdlCreateOnly
Deprecated.migrate toddlCreateOnly(boolean)
. -
ddlSeedSql
Set a 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.
-
setDdlSeedSql
Deprecated.migrate toddlSeedSql(String)
. -
ddlInitSql
Set a SQL script to execute before the "create all" DDL has been run. -
setDdlInitSql
Deprecated.migrate toddlInitSql(String)
. -
ddlHeader
Set the header to use with DDL generation. -
setDdlHeader
Deprecated.migrate toddlHeader(String)
. -
ddlStrictMode
Set to false to turn off strict mode allowing non-null columns to not have a default value. -
setDdlStrictMode
Deprecated.migrate toddlStrictMode(boolean)
. -
ddlPlaceholders
Set a comma and equals delimited placeholders that are substituted in DDL scripts. -
setDdlPlaceholders
Deprecated.migrate toddlPlaceholders(String)
. -
ddlPlaceholderMap
Set a map of placeholder values that are substituted in DDL scripts. -
setDdlPlaceholderMap
Deprecated.migrate toddlPlaceholderMap(Map)
. -
disableClasspathSearch
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 SQL functions such as SqlQuery, SqlUpdate etc. -
setDisableClasspathSearch
Deprecated.migrate todisableClasspathSearch(boolean)
. -
jodaLocalTimeMode
Set the mode to use for Joda LocalTime support 'normal' or 'utc'. -
setJodaLocalTimeMode
Deprecated.migrate tojodaLocalTimeMode(String)
. -
addClass
Programmatically add classes (typically entities) that this server should use.The class can be an Entity, Embedded type, ScalarType, BeanPersistListener, BeanFinder or BeanPersistController.
If no classes are specified then the classes are found automatically via searching the class path.
- Parameters:
cls
- the entity type (or other type) that should be registered by this database.
-
addAll
Register all the classes (typically entity classes). -
addPackage
Add a package to search for entities via class path search.This is only used if classes have not been explicitly specified.
-
setPackages
Set packages to search for entities via class path search.This is only used if classes have not been explicitly specified.
-
classes
Set the list of classes (entities, listeners, scalarTypes etc) that should be used for this database.If no classes are specified then the classes are found automatically via searching the class path.
Alternatively the classes can contain added via
addClass(Class)
. -
skipCacheAfterWrite
Set to false when we still want to hit the cache after a write has occurred on a transaction. -
setSkipCacheAfterWrite
Deprecated.migrate toskipCacheAfterWrite(boolean)
. -
updateAllPropertiesInBatch
Set to false if by default updates in JDBC batch should not include all properties.This mode can be explicitly set per transaction.
- See Also:
-
setUpdateAllPropertiesInBatch
Deprecated.migrate toupdateAllPropertiesInBatch(boolean)
. -
resourceDirectory
Sets the resource directory. -
setResourceDirectory
Deprecated.migrate toresourceDirectory(String)
. -
addCustomMapping
DatabaseBuilder addCustomMapping(DbType type, String columnDefinition, io.ebean.annotation.Platform platform) Add a custom type mapping.// set the default mapping for BigDecimal.class/decimal config.addCustomMapping(DbType.DECIMAL, "decimal(18,6)"); // set the default mapping for String.class/varchar but only for Postgres config.addCustomMapping(DbType.VARCHAR, "text", Platform.POSTGRES);
- Parameters:
type
- The DB type this mapping should apply tocolumnDefinition
- The column definition that should be usedplatform
- Optionally specify the platform this mapping should apply to.
-
addCustomMapping
Add a custom type mapping that applies to all platforms.// set the default mapping for BigDecimal/decimal config.addCustomMapping(DbType.DECIMAL, "decimal(18,6)"); // set the default mapping for String/varchar config.addCustomMapping(DbType.VARCHAR, "text");
- Parameters:
type
- The DB type this mapping should apply tocolumnDefinition
- The column definition that should be used
-
add
Register a BeanQueryAdapter instance.Note alternatively you can use
setQueryAdapters(List)
to set all the BeanQueryAdapter instances. -
setQueryAdapters
Register all the BeanQueryAdapter instances.Note alternatively you can use
add(BeanQueryAdapter)
to add BeanQueryAdapter instances one at a time. -
setIdGenerators
Set the custom IdGenerator instances. -
add
Register a customer IdGenerator instance. -
add
Register a BeanPersistController instance.Note alternatively you can use
setPersistControllers(List)
to set all the BeanPersistController instances. -
add
Register a BeanPostLoad instance.Note alternatively you can use
setPostLoaders(List)
to set all the BeanPostLoad instances. -
add
Register a BeanPostConstructListener instance.Note alternatively you can use
setPostConstructListeners(List)
to set all the BeanPostConstructListener instances. -
setFindControllers
Set the list of BeanFindController instances. -
setPostLoaders
Set the list of BeanPostLoader instances. -
setPostConstructListeners
Set the list of BeanPostLoader instances. -
setPersistControllers
Register all the BeanPersistController instances.Note alternatively you can use
add(BeanPersistController)
to add BeanPersistController instances one at a time. -
add
Register a BeanPersistListener instance.Note alternatively you can use
setPersistListeners(List)
to set all the BeanPersistListener instances. -
add
Add a BulkTableEventListener -
addServerConfigStartup
Add a ServerConfigStartup. -
setPersistListeners
Register all the BeanPersistListener instances.Note alternatively you can use
add(BeanPersistListener)
to add BeanPersistListener instances one at a time. -
persistenceContextScope
Set the PersistenceContext scope to be used if one is not explicitly set on a query. This defaults toPersistenceContextScope.TRANSACTION
. The PersistenceContextScope can specified on each query via.Query#setPersistenceContextScope(io.ebean.PersistenceContextScope)
. If it is not set on the query this scope is used.- See Also:
-
setPersistenceContextScope
@Deprecated DatabaseBuilder setPersistenceContextScope(PersistenceContextScope persistenceContextScope) Deprecated.migrate topersistenceContextScope(PersistenceContextScope)
. -
classLoadConfig
Set the ClassLoadConfig which is used to detect Joda, Java8 types etc and also create new instances of plugins given a className. -
setClassLoadConfig
Deprecated.migrate toclassLoadConfig(ClassLoadConfig)
. -
loadFromProperties
DatabaseBuilder loadFromProperties()Load settings from application.properties, application.yaml and other sources.Uses
avaje-config
to load configuration properties. Goto https://avaje.io/config for detail on how and where properties are loaded from. -
loadFromProperties
Load the settings from the given properties -
objectMapper
Set the Jackson ObjectMapper.Note that this is not strongly typed as Jackson ObjectMapper is an optional dependency.
-
setObjectMapper
Deprecated.migrate toobjectMapper(Object)
. -
expressionEqualsWithNullAsNoop
Set to true if you want eq("someProperty", null) to generate "1=1" rather than "is null" sql expression.Setting this to true has the effect that eq(propertyName, value), ieq(propertyName, value) and ne(propertyName, value) have no effect when the value is null. The expression factory adds a NoopExpression which will add "1=1" into the SQL rather than "is null".
-
setExpressionEqualsWithNullAsNoop
@Deprecated DatabaseBuilder setExpressionEqualsWithNullAsNoop(boolean expressionEqualsWithNullAsNoop) Deprecated.migrate toexpressionEqualsWithNullAsNoop(boolean)
. -
expressionNativeIlike
Set to true to use native ILIKE expression if supported by the database platform (e.g. Postgres). -
setExpressionNativeIlike
Deprecated.migrate toexpressionNativeIlike(boolean)
. -
enabledL2Regions
Set the enabled L2 cache regions (comma delimited). -
setEnabledL2Regions
Deprecated.migrate toenabledL2Regions(String)
. -
disableL2Cache
Set to true to disable L2 caching. Typically useful in performance testing. -
setDisableL2Cache
Deprecated.migrate todisableL2Cache(boolean)
. -
localOnlyL2Cache
Force the use of local only L2 cache. Effectively ignore l2 cache plugin like ebean-redis etc. -
setLocalOnlyL2Cache
Deprecated.migrate tolocalOnlyL2Cache(boolean)
. -
useValidationNotNull
Controls if Ebean should ignore&x64;javax.validation.contstraints.NotNull
or&x64;jakarta.validation.contstraints.NotNull
with respect to generating aNOT NULL
column.Normally when Ebean sees javax NotNull annotation it means that column is defined as NOT NULL. Set this to
false
and the javax NotNull annotation is effectively ignored (and we instead use Ebean's own NotNull annotation or JPA Column(nullable=false) annotation. -
setUseValidationNotNull
Deprecated.migrate touseValidationNotNull(boolean)
. -
notifyL2CacheInForeground
Set this to true to run L2 cache notification in the foreground.In general we don't want to do that as when we use a distributed cache (like Ignite, Hazelcast etc) we are making network calls and we prefer to do this in background and not impact the response time of the executing transaction.
-
setNotifyL2CacheInForeground
Deprecated.migrate tonotifyL2CacheInForeground(boolean)
. -
queryPlanTTLSeconds
Set the time to live for ebean's internal query plan.This is the plan that knows how to execute the query, read the result and collects execution metrics. By default this is set to 5 mins.
-
setQueryPlanTTLSeconds
Deprecated.migrate toqueryPlanTTLSeconds(int)
. -
newPlatformConfig
Create a new PlatformConfig based of the one held but with overridden properties by reading properties with the given path and prefix.Typically used in Db Migration generation for many platform targets that might have different configuration for IdType, UUID, quoted identifiers etc.
- Parameters:
propertiesPath
- The properties path used for loading and setting propertiesplatformPrefix
- The prefix used for loading and setting properties- Returns:
- A copy of the PlatformConfig with overridden properties
-
addMappingLocation
Add a mapping location to search for xml mapping via class path search. -
mappingLocations
Set mapping locations to search for xml mapping via class path search.This is only used if classes have not been explicitly specified.
-
setMappingLocations
Deprecated.migrate tomappingLocations(List)
. -
idGeneratorAutomatic
Set to false such that Id properties require explicit@GeneratedValue
mapping before they are assigned Identity or Sequence generation based on platform. -
setIdGeneratorAutomatic
Deprecated.migrate toidGeneratorAutomatic(boolean)
. -
queryPlanEnable
Set to true to enable query plan capture. -
setQueryPlanEnable
Deprecated.migrate toqueryPlanEnable(boolean)
. -
queryPlanThresholdMicros
Set the query plan collection threshold in microseconds.Queries executing slower than this will have bind values captured such that later the query plan can be captured and reported.
-
setQueryPlanThresholdMicros
Deprecated.migrate toqueryPlanThresholdMicros(long)
. -
queryPlanCapture
Set to true to turn on periodic capture of query plans. -
setQueryPlanCapture
Deprecated.migrate toqueryPlanCapture(boolean)
. -
queryPlanCapturePeriodSecs
Set the frequency in seconds to capture query plans. -
setQueryPlanCapturePeriodSecs
Deprecated.migrate toqueryPlanCapturePeriodSecs(long)
. -
queryPlanCaptureMaxTimeMillis
Set 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.
-
setQueryPlanCaptureMaxTimeMillis
Deprecated.migrate toqueryPlanCaptureMaxTimeMillis(long)
. -
queryPlanCaptureMaxCount
Set the max number of query plans captured per request. -
setQueryPlanCaptureMaxCount
Deprecated.migrate toqueryPlanCaptureMaxCount(int)
. -
queryPlanListener
Set the listener used to process captured query plans. -
setQueryPlanListener
Deprecated.migrate toqueryPlanListener(QueryPlanListener)
. -
dumpMetricsOnShutdown
Set to true if metrics should be dumped when the server is shutdown. -
setDumpMetricsOnShutdown
Deprecated.migrate todumpMetricsOnShutdown(boolean)
. -
dumpMetricsOptions
Include 'sql' or 'hash' in options such that they are included in the output.- Parameters:
dumpMetricsOptions
- Example "sql,hash", "sql"
-
setDumpMetricsOptions
Deprecated.migrate todumpMetricsOptions(String)
. -
loadModuleInfo
Set false to turn off automatic registration of entity beans.When using query beans that also generates a module info class that can register the entity bean classes (to aDatabaseBuilder classpath scanning). This is on by default and setting this to false turns it off.
-
setLoadModuleInfo
Deprecated.migrate toloadModuleInfo(boolean)
. -
includeLabelInSql
Set if generated SQL SELECT should include the query label as an inline SQL comment (to help reference back from the SQL to the code that executed the query.- Parameters:
includeLabelInSql
- When true include a SQL inline comment in generated SELECT queries.
-
metricNaming
Set the naming convention to apply to metrics names. -
setMetricNaming
Deprecated.migrate tometricNaming(Function)
. -
lengthCheck
Sets the length check mode.
-
allQuotedIdentifiers(boolean)
.