public class ServerConfig extends Object
Used to programmatically construct an EbeanServer and optionally register it with the Ebean singleton.
If you just use Ebean without this programmatic configuration Ebean will read the ebean.properties file and take the configuration from there. This usually includes searching the class path and automatically registering any entity classes and listeners etc.
ServerConfig c = new ServerConfig();
c.setName("db");
// read the ebean.properties and load
// those settings into this serverConfig object
c.loadFromProperties();
// add any classes found in the app.data package
c.addPackage("com.myapp.domain");
// register as the 'Default' server
c.setDefaultServer(true);
EbeanServer server = EbeanServerFactory.create(c);
EbeanServerFactory| Modifier and Type | Class and Description |
|---|---|
static class |
ServerConfig.DbUuid
Specify how UUID is stored.
|
| Constructor and Description |
|---|
ServerConfig()
Construct a Server Configuration for programmatically creating an EbeanServer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(BeanPersistController beanPersistController)
Register a BeanPersistController instance.
|
void |
add(BeanPersistListener beanPersistListener)
Register a BeanPersistListener instance.
|
void |
add(BeanPostLoad postLoad)
Register a BeanPostLoad instance.
|
void |
add(BeanQueryAdapter beanQueryAdapter)
Register a BeanQueryAdapter instance.
|
void |
add(BulkTableEventListener bulkTableEventListener)
Add a BulkTableEventListener
|
void |
add(IdGenerator idGenerator)
Register a customer IdGenerator instance.
|
void |
add(TransactionEventListener listener)
Register a TransactionEventListener instance
|
void |
addClass(Class<?> cls)
Programmatically add classes (typically entities) that this server should
use.
|
void |
addPackage(String packageName)
Add a package to search for entities via class path search.
|
void |
addServerConfigStartup(ServerConfigStartup configStartupListener)
Add a ServerConfigStartup.
|
PersistBatch |
appliedPersistBatchOnCascade()
Return the PersistBatch mode to use for 'batchOnCascade' taking into account if the database
platform supports getGeneratedKeys in batch mode.
|
protected <T> T |
createInstance(Class<T> pluginType,
String classname)
Return the instance to use (can be null) for the given plugin.
|
protected <T> T |
createInstance(PropertiesWrapper properties,
Class<T> pluginType,
String key,
T instance)
Return the instance to use (can be null) for the given plugin.
|
String |
getAsOfSysPeriod()
Return the database column used to support history and 'As of' queries.
|
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.
|
AutoTuneConfig |
getAutoTuneConfig()
Return the configuration for AutoTune.
|
int |
getBackgroundExecutorSchedulePoolSize()
Return the Background executor schedule pool size.
|
int |
getBackgroundExecutorShutdownSecs()
Return the Background executor shutdown seconds.
|
List<BulkTableEventListener> |
getBulkTableEventListeners()
Return the list of BulkTableEventListener instances.
|
int |
getCacheMaxIdleTime()
Return the L2 cache default max idle time in seconds.
|
int |
getCacheMaxSize()
Return the L2 cache default max size.
|
int |
getCacheMaxTimeToLive()
Return the L2 cache default max time to live in seconds.
|
ChangeLogListener |
getChangeLogListener()
Return the ChangeLogListener which actually performs the logging of change sets
in the background.
|
ChangeLogPrepare |
getChangeLogPrepare()
Return the ChangeLogPrepare.
|
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.
|
List<Class<?>> |
getClasses()
Return the classes registered for this server.
|
ClassLoadConfig |
getClassLoadConfig()
Return the ClassLoadConfig which is used to detect Joda, Java8 types etc and also
create new instances of plugins given a className.
|
DbConstraintNaming |
getConstraintNaming()
Return the constraint naming convention used in DDL generation.
|
ContainerConfig |
getContainerConfig()
Return the container / clustering configuration.
|
CurrentUserProvider |
getCurrentUserProvider()
Return the CurrentUserProvider.
|
String |
getDatabaseBooleanFalse()
Return a value used to represent FALSE in the database.
|
String |
getDatabaseBooleanTrue()
Return a value used to represent TRUE in the database.
|
DatabasePlatform |
getDatabasePlatform()
Return the database platform to use for this server.
|
String |
getDatabasePlatformName()
Return the database platform name (can be null).
|
int |
getDatabaseSequenceBatchSize()
Return the number of DB sequence values that should be preallocated.
|
DataSource |
getDataSource()
Return the DataSource.
|
org.avaje.datasource.DataSourceConfig |
getDataSourceConfig()
Return the configuration to build a DataSource using Ebean's own DataSource
implementation.
|
String |
getDataSourceJndiName()
Return the JNDI name of the DataSource to use.
|
String |
getDataTimeZone()
Return the time zone to use when reading/writing Timestamps via JDBC.
|
DbEncrypt |
getDbEncrypt()
Return the DbEncrypt used to encrypt and decrypt properties.
|
ServerConfig.DbUuid |
getDbUuid()
Return the DB type used to store UUID.
|
String |
getDdlInitSql()
Return a SQL script to execute before the "create all" DDL has been run.
|
String |
getDdlSeedSql()
Return SQL script to execute after the "create all" DDL has been run.
|
DocStoreConfig |
getDocStoreConfig()
Return the configuration for the ElasticSearch integration.
|
EncryptDeployManager |
getEncryptDeployManager()
Return the EncryptDeployManager.
|
EncryptKeyManager |
getEncryptKeyManager()
Return the EncryptKeyManager.
|
Encryptor |
getEncryptor()
Return the Encryptor used to encrypt data on the java client side (as
opposed to DB encryption functions).
|
ExternalTransactionManager |
getExternalTransactionManager()
Return the external transaction manager.
|
List<BeanFindController> |
getFindControllers()
Return the list of BeanFindController instances.
|
String |
getHistoryTableSuffix()
Return the history table suffix (defaults to _history).
|
List<IdGenerator> |
getIdGenerators()
Return the custom IdGenerator instances.
|
int |
getJdbcFetchSizeFindEach()
Return the default JDBC fetchSize hint for findEach/findEachWhile queries.
|
int |
getJdbcFetchSizeFindList()
Return the default JDBC fetchSize hint for findList queries.
|
String |
getJodaLocalTimeMode()
Return the mode to use for Joda LocalTime support 'normal' or 'utc'.
|
JsonConfig.DateTime |
getJsonDateTime()
Return the JSON format used for DateTime types.
|
com.fasterxml.jackson.core.JsonFactory |
getJsonFactory()
Return the Jackson JsonFactory to use.
|
JsonConfig.Include |
getJsonInclude()
Return the JSON include mode used when writing JSON.
|
int |
getLazyLoadBatchSize()
Return the default batch size for lazy loading of beans and collections.
|
int |
getMaxCallStack()
Return the max call stack to use for origin location.
|
DbMigrationConfig |
getMigrationConfig()
Return the DB migration configuration.
|
String |
getName()
Return the name of the EbeanServer.
|
NamingConvention |
getNamingConvention()
Return the NamingConvention.
|
Object |
getObjectMapper()
Return the Jackson ObjectMapper.
|
List<String> |
getPackages()
Return packages to search for entities via class path search.
|
PersistBatch |
getPersistBatch()
Return the PersistBatch mode to use by default at the transaction level.
|
PersistBatch |
getPersistBatchOnCascade()
Return the JDBC batch mode to use per save(), delete(), insert() or update() request.
|
int |
getPersistBatchSize()
Return the batch size used for JDBC batching.
|
List<BeanPersistController> |
getPersistControllers()
Return the BeanPersistController instances.
|
PersistenceContextScope |
getPersistenceContextScope()
Return the default PersistenceContextScope to be used if one is not explicitly set on a query.
|
List<BeanPersistListener> |
getPersistListeners()
Return the BeanPersistListener instances.
|
List<BeanPostLoad> |
getPostLoaders()
Return the list of BeanPostLoader instances.
|
Properties |
getProperties()
Return the properties that we used for configuration and were set via a call to loadFromProperties().
|
List<BeanQueryAdapter> |
getQueryAdapters()
Return the BeanQueryAdapter instances.
|
int |
getQueryBatchSize()
Gets the query batch size.
|
int |
getQueryCacheMaxIdleTime()
Return the L2 query cache default max idle time in seconds.
|
int |
getQueryCacheMaxSize()
Return the L2 query cache default max size.
|
int |
getQueryCacheMaxTimeToLive()
Return the L2 query cache default max time to live in seconds.
|
ReadAuditLogger |
getReadAuditLogger()
Return the ReadAuditLogger to use.
|
ReadAuditPrepare |
getReadAuditPrepare()
Return the ReadAuditPrepare to use.
|
String |
getResourceDirectory()
Returns the resource directory.
|
ServerCacheManager |
getServerCacheManager()
Return the ServerCacheManager.
|
ServerCachePlugin |
getServerCachePlugin()
Return the ServerCachePlugin.
|
List<ServerConfigStartup> |
getServerConfigStartupListeners()
Return the list of ServerConfigStartup instances.
|
Object |
getServiceObject(String key)
Return the service object given the key.
|
List<TransactionEventListener> |
getTransactionEventListeners()
Return the TransactionEventListener instances.
|
boolean |
isAutoCommitMode()
Return true if autoCommit mode is on.
|
boolean |
isChangeLogIncludeInserts()
Return true if inserts should be included in the change log by default.
|
boolean |
isCollectQueryOrigins()
Return true if query plans should also collect their 'origins'.
|
boolean |
isCollectQueryStatsByNode()
Return true if the ebeanServer should collection query statistics by ObjectGraphNode.
|
boolean |
isDdlCreateOnly()
Return true if the "drop all ddl" should be skipped.
|
boolean |
isDdlGenerate()
Return true if the DDL should be generated.
|
boolean |
isDdlRun()
Return true if the DDL should be run.
|
boolean |
isDefaultServer()
Return true if this server should be registered as the "default" server
with the Ebean singleton.
|
boolean |
isDisableClasspathSearch()
Return true if the class path search should be disabled.
|
boolean |
isDisableL2Cache()
Return true if L2 cache is disabled.
|
boolean |
isDurationWithNanos()
Return true if Duration should be persisted with nanos precision (SQL DECIMAL).
|
boolean |
isEagerFetchLobs()
Return true if LOB's should default to fetch eager.
|
boolean |
isExplicitTransactionBeginMode()
Return true if transaction begin should be started with explicit statement.
|
boolean |
isExpressionEqualsWithNullAsNoop()
Return true if eq("someProperty", null) should to generate "1=1" rather than "is null" sql expression.
|
boolean |
isExpressionNativeIlike()
Return true if native ILIKE expression should be used if supported by the database platform (e.g.
|
boolean |
isLocalTimeWithNanos()
Return true if LocalTime should be persisted with nanos precision.
|
boolean |
isRegister()
Return true if this server should be registered with the Ebean singleton
when it is created.
|
boolean |
isSkipCacheAfterWrite()
Return true if L2 bean cache should be skipped once writes have occurred on a transaction.
|
boolean |
isTransactionRollbackOnChecked()
Return true if transactions should rollback on checked exceptions.
|
boolean |
isUpdateAllPropertiesInBatch()
Returns true if updates in JDBC batch default to include all properties by default.
|
boolean |
isUpdateChangesOnly()
Return true to only update changed properties.
|
boolean |
isUpdatesDeleteMissingChildren()
Return true if updates by default delete missing children when cascading save to a OneToMany or
ManyToMany.
|
boolean |
isUseJtaTransactionManager()
Return true if we are running in a JTA Transaction manager.
|
protected void |
loadAutoTuneSettings(PropertiesWrapper p)
This is broken out to allow overridden behaviour.
|
protected void |
loadDataSourceSettings(PropertiesWrapper p)
loads the data source settings to preserve existing behaviour.
|
protected void |
loadDocStoreSettings(PropertiesWrapper p)
This is broken out to allow overridden behaviour.
|
void |
loadFromProperties()
Load settings from ebean.properties.
|
void |
loadFromProperties(Properties properties)
Load the settings from the given properties
|
protected void |
loadSettings(PropertiesWrapper p)
Load the configuration settings from the properties file.
|
void |
loadTestProperties()
Load settings from test-ebean.properties and do nothing if the properties is not found.
|
void |
putServiceObject(String key,
Object configObject)
Put a service object into configuration such that it can be passed to a plugin.
|
<T> T |
service(Class<T> spiService)
Return the first service using the service loader (or null).
|
<T> ServiceLoader<T> |
serviceLoad(Class<T> spiService)
Return the service loader using the classLoader defined in ClassLoadConfig.
|
void |
setAsOfSysPeriod(String asOfSysPeriod)
Set the database column used to support history and 'As of' queries.
|
void |
setAsOfViewSuffix(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.
|
void |
setAutoCommitMode(boolean autoCommitMode)
Set to true if autoCommit mode is on and Ebean should use autoCommit friendly Transactions and TransactionManager.
|
void |
setAutoTuneConfig(AutoTuneConfig autoTuneConfig)
Set the configuration for AutoTune.
|
void |
setBackgroundExecutorSchedulePoolSize(int backgroundExecutorSchedulePoolSize)
Set the Background executor schedule pool size.
|
void |
setBackgroundExecutorShutdownSecs(int backgroundExecutorShutdownSecs)
Set the Background executor shutdown seconds.
|
void |
setCacheMaxIdleTime(int cacheMaxIdleTime)
Set the L2 cache default max idle time in seconds.
|
void |
setCacheMaxSize(int cacheMaxSize)
Set the L2 cache default max size.
|
void |
setCacheMaxTimeToLive(int cacheMaxTimeToLive)
Set the L2 cache default max time to live in seconds.
|
void |
setChangeLogIncludeInserts(boolean changeLogIncludeInserts)
Set if inserts should be included in the change log by default.
|
void |
setChangeLogListener(ChangeLogListener changeLogListener)
Set the ChangeLogListener which actually performs the logging of change sets
in the background.
|
void |
setChangeLogPrepare(ChangeLogPrepare changeLogPrepare)
Set the ChangeLogPrepare.
|
void |
setChangeLogRegister(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.
|
void |
setClasses(List<Class<?>> classes)
Set the list of classes (entities, listeners, scalarTypes etc) that should
be used for this server.
|
void |
setClassLoadConfig(ClassLoadConfig classLoadConfig)
Set the ClassLoadConfig which is used to detect Joda, Java8 types etc and also
create new instances of plugins given a className.
|
void |
setCollectQueryOrigins(boolean collectQueryOrigins)
Set to true if query plans should collect their 'origin' points.
|
void |
setCollectQueryStatsByNode(boolean collectQueryStatsByNode)
Set to true to collection query execution statistics by ObjectGraphNode.
|
void |
setConstraintNaming(DbConstraintNaming constraintNaming)
Set the constraint naming convention used in DDL generation.
|
void |
setContainerConfig(ContainerConfig containerConfig)
Set the container / clustering configuration.
|
void |
setCurrentUserProvider(CurrentUserProvider currentUserProvider)
Set the CurrentUserProvider.
|
void |
setDatabaseBooleanFalse(String databaseFalse)
Set the value to represent FALSE in the database.
|
void |
setDatabaseBooleanTrue(String databaseTrue)
Set the value to represent TRUE in the database.
|
void |
setDatabasePlatform(DatabasePlatform databasePlatform)
Explicitly set the database platform to use.
|
void |
setDatabasePlatformName(String databasePlatformName)
Explicitly set the database platform name
|
void |
setDatabaseSequenceBatch(int databaseSequenceBatchSize)
Set the number of DB sequence values that should be preallocated and cached
by Ebean.
|
void |
setDatabaseSequenceBatchSize(int databaseSequenceBatchSize)
Set the number of sequences to fetch/preallocate when using DB sequences.
|
void |
setDataSource(DataSource dataSource)
Set a DataSource.
|
void |
setDataSourceConfig(org.avaje.datasource.DataSourceConfig dataSourceConfig)
Set the configuration required to build a DataSource using Ebean's own
DataSource implementation.
|
void |
setDataSourceJndiName(String dataSourceJndiName)
Set the JNDI name of the DataSource to use.
|
void |
setDataTimeZone(String dataTimeZone)
Set the time zone to use when reading/writing Timestamps via JDBC.
|
void |
setDbEncrypt(DbEncrypt dbEncrypt)
Set the DbEncrypt used to encrypt and decrypt properties.
|
void |
setDbUuid(ServerConfig.DbUuid dbUuid)
Set the DB type used to store UUID.
|
void |
setDdlCreateOnly(boolean ddlCreateOnly)
Set to true if the "drop all ddl" should be skipped.
|
void |
setDdlGenerate(boolean ddlGenerate)
Set to true to generate the "create all" DDL on startup.
|
void |
setDdlInitSql(String ddlInitSql)
Set a SQL script to execute before the "create all" DDL has been run.
|
void |
setDdlRun(boolean ddlRun)
Set to true to run the generated "create all DDL" on startup.
|
void |
setDdlSeedSql(String ddlSeedSql)
Set a SQL script to execute after the "create all" DDL has been run.
|
void |
setDefaultServer(boolean defaultServer)
Set true if this EbeanServer should be registered as the "default" server
with the Ebean singleton.
|
void |
setDisableClasspathSearch(boolean disableClasspathSearch)
Set to true to disable the class path search even for the case where no entity bean classes
have been registered.
|
void |
setDisableL2Cache(boolean disableL2Cache)
Set to true to disable L2 caching.
|
void |
setDocStoreConfig(DocStoreConfig docStoreConfig)
Set the configuration for the ElasticSearch integration.
|
void |
setDurationWithNanos(boolean durationWithNanos)
Set to true if Duration should be persisted with nanos precision (SQL DECIMAL).
|
void |
setEagerFetchLobs(boolean eagerFetchLobs)
Set to true if you want LOB's to be fetch eager by default.
|
void |
setEncryptDeployManager(EncryptDeployManager encryptDeployManager)
Set the EncryptDeployManager.
|
void |
setEncryptKeyManager(EncryptKeyManager encryptKeyManager)
Set the EncryptKeyManager.
|
void |
setEncryptor(Encryptor encryptor)
Set the Encryptor used to encrypt data on the java client side (as opposed
to DB encryption functions).
|
void |
setExplicitTransactionBeginMode(boolean explicitTransactionBeginMode)
Set to true if transaction begin should be started with explicit statement.
|
void |
setExpressionEqualsWithNullAsNoop(boolean expressionEqualsWithNullAsNoop)
Set to true if you want eq("someProperty", null) to generate "1=1" rather than "is null" sql expression.
|
void |
setExpressionNativeIlike(boolean expressionNativeIlike)
Set to true to use native ILIKE expression if supported by the database platform (e.g.
|
void |
setExternalTransactionManager(ExternalTransactionManager externalTransactionManager)
Set the external transaction manager.
|
void |
setFindControllers(List<BeanFindController> findControllers)
Set the list of BeanFindController instances.
|
void |
setHistoryTableSuffix(String historyTableSuffix)
Set the history table suffix.
|
void |
setIdGenerators(List<IdGenerator> idGenerators)
Set the custom IdGenerator instances.
|
void |
setJdbcFetchSizeFindEach(int jdbcFetchSizeFindEach)
Set the default JDBC fetchSize hint for findEach/findEachWhile queries.
|
void |
setJdbcFetchSizeFindList(int jdbcFetchSizeFindList)
Set the default JDBC fetchSize hint for findList queries.
|
void |
setJodaLocalTimeMode(String jodaLocalTimeMode)
Set the mode to use for Joda LocalTime support 'normal' or 'utc'.
|
void |
setJsonDateTime(JsonConfig.DateTime jsonDateTime)
Set the JSON format to use for DateTime types.
|
void |
setJsonFactory(com.fasterxml.jackson.core.JsonFactory jsonFactory)
Set the Jackson JsonFactory to use.
|
void |
setJsonInclude(JsonConfig.Include jsonInclude)
Set the JSON include mode used when writing JSON.
|
void |
setLazyLoadBatchSize(int lazyLoadBatchSize)
Set the default batch size for lazy loading.
|
void |
setLocalTimeWithNanos(boolean localTimeWithNanos)
Set to true if LocalTime should be persisted with nanos precision.
|
void |
setMaxCallStack(int maxCallStack)
Set the max call stack to use for origin location.
|
void |
setMigrationConfig(DbMigrationConfig migrationConfig)
Set the DB migration configuration.
|
void |
setName(String name)
Set the name of the EbeanServer.
|
void |
setNamingConvention(NamingConvention namingConvention)
Set the NamingConvention.
|
void |
setObjectMapper(Object objectMapper)
Set the Jackson ObjectMapper.
|
void |
setPackages(List<String> packages)
Set packages to search for entities via class path search.
|
void |
setPersistBatch(PersistBatch persistBatch)
Set the JDBC batch mode to use at the transaction level.
|
void |
setPersistBatching(boolean persistBatching)
Deprecated, please migrate to using setPersistBatch().
|
void |
setPersistBatchOnCascade(PersistBatch persistBatchOnCascade)
Set the JDBC batch mode to use per save(), delete(), insert() or update() request.
|
void |
setPersistBatchSize(int persistBatchSize)
Set the batch size used for JDBC batching.
|
void |
setPersistControllers(List<BeanPersistController> persistControllers)
Register all the BeanPersistController instances.
|
void |
setPersistenceContextScope(PersistenceContextScope persistenceContextScope)
Set the PersistenceContext scope to be used if one is not explicitly set on a query.
|
void |
setPersistListeners(List<BeanPersistListener> persistListeners)
Register all the BeanPersistListener instances.
|
void |
setPostLoaders(List<BeanPostLoad> postLoaders)
Set the list of BeanPostLoader instances.
|
void |
setQueryAdapters(List<BeanQueryAdapter> queryAdapters)
Register all the BeanQueryAdapter instances.
|
void |
setQueryBatchSize(int queryBatchSize)
Sets the query batch size.
|
void |
setQueryCacheMaxIdleTime(int queryCacheMaxIdleTime)
Set the L2 query cache default max idle time in seconds.
|
void |
setQueryCacheMaxSize(int queryCacheMaxSize)
Set the L2 query cache default max size.
|
void |
setQueryCacheMaxTimeToLive(int queryCacheMaxTimeToLive)
Set the L2 query cache default max time to live in seconds.
|
void |
setReadAuditLogger(ReadAuditLogger readAuditLogger)
Set the ReadAuditLogger to use.
|
void |
setReadAuditPrepare(ReadAuditPrepare readAuditPrepare)
Set the ReadAuditPrepare to use.
|
void |
setRegister(boolean register)
Set to false if you do not want this server to be registered with the Ebean
singleton when it is created.
|
void |
setResourceDirectory(String resourceDirectory)
Sets the resource directory.
|
void |
setServerCacheManager(ServerCacheManager serverCacheManager)
Set the ServerCacheManager to use.
|
void |
setServerCachePlugin(ServerCachePlugin serverCachePlugin)
Set the ServerCachePlugin to use.
|
void |
setSkipCacheAfterWrite(boolean skipCacheAfterWrite)
Set to false when we still want to hit the cache after a write has occurred on a transaction.
|
void |
setTransactionEventListeners(List<TransactionEventListener> transactionEventListeners)
Register all the TransactionEventListener instances.
|
void |
setTransactionRollbackOnChecked(boolean transactionRollbackOnChecked)
Set to true if transactions should by default rollback on checked exceptions.
|
void |
setUpdateAllPropertiesInBatch(boolean updateAllPropertiesInBatch)
Set to false if by default updates in JDBC batch should not include all properties.
|
void |
setUpdateChangesOnly(boolean updateChangesOnly)
Set to true to only update changed properties.
|
void |
setUpdatesDeleteMissingChildren(boolean updatesDeleteMissingChildren)
Set if updates by default delete missing children when cascading save to a OneToMany or
ManyToMany.
|
void |
setUseJtaTransactionManager(boolean useJtaTransactionManager)
Set to true if we are running in a JTA Transaction manager.
|
public ServerConfig()
public void putServiceObject(String key, Object configObject)
For example, put IgniteConfiguration in to be passed to the Ignite plugin.
public Object getServiceObject(String key)
public com.fasterxml.jackson.core.JsonFactory getJsonFactory()
If not set a default implementation will be used.
public void setJsonFactory(com.fasterxml.jackson.core.JsonFactory jsonFactory)
If not set a default implementation will be used.
public JsonConfig.DateTime getJsonDateTime()
public void setJsonDateTime(JsonConfig.DateTime jsonDateTime)
public JsonConfig.Include getJsonInclude()
public void setJsonInclude(JsonConfig.Include jsonInclude)
Set to NON_NULL or NON_EMPTY to suppress nulls or null & empty collections respectively.
public ContainerConfig getContainerConfig()
public void setContainerConfig(ContainerConfig containerConfig)
public boolean isRegister()
By default this is set to true.
public void setRegister(boolean register)
By default this is set to true.
public boolean isDefaultServer()
This is only used when setRegister(boolean) is also true.
public void setDefaultServer(boolean defaultServer)
This is only used when setRegister(boolean) is also true.
public CurrentUserProvider getCurrentUserProvider()
public void setCurrentUserProvider(CurrentUserProvider currentUserProvider)
public PersistBatch getPersistBatch()
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.
public void setPersistBatch(PersistBatch persistBatch)
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.
public PersistBatch getPersistBatchOnCascade()
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.
public void setPersistBatchOnCascade(PersistBatch persistBatchOnCascade)
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.
public void setPersistBatching(boolean persistBatching)
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 to setPersistBatch(PersistBatch.NONE)
public int getPersistBatchSize()
public void setPersistBatchSize(int persistBatchSize)
You can also set the batch size on the transaction.
Transaction.setBatchSize(int)public int getQueryBatchSize()
public void setQueryBatchSize(int queryBatchSize)
queryBatchSize - the new query batch sizepublic int getLazyLoadBatchSize()
public void setLazyLoadBatchSize(int lazyLoadBatchSize)
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.
public void setDatabaseSequenceBatchSize(int databaseSequenceBatchSize)
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).
public int getJdbcFetchSizeFindList()
public void setJdbcFetchSizeFindList(int jdbcFetchSizeFindList)
public int getJdbcFetchSizeFindEach()
public void setJdbcFetchSizeFindEach(int jdbcFetchSizeFindEach)
public ChangeLogPrepare getChangeLogPrepare()
This is used to set user context information to the ChangeSet in the foreground thread prior to the logging occurring in a background thread.
public void setChangeLogPrepare(ChangeLogPrepare 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.
public ChangeLogListener getChangeLogListener()
public void setChangeLogListener(ChangeLogListener changeLogListener)
public ChangeLogRegister getChangeLogRegister()
public void setChangeLogRegister(ChangeLogRegister changeLogRegister)
public boolean isChangeLogIncludeInserts()
public void setChangeLogIncludeInserts(boolean changeLogIncludeInserts)
public ReadAuditLogger getReadAuditLogger()
public void setReadAuditLogger(ReadAuditLogger readAuditLogger)
public ReadAuditPrepare getReadAuditPrepare()
public void setReadAuditPrepare(ReadAuditPrepare readAuditPrepare)
It is expected that an implementation is used that read user context information (user id, user ip address etc) and sets it on the ReadEvent bean before it is sent to the ReadAuditLogger.
public DbMigrationConfig getMigrationConfig()
public void setMigrationConfig(DbMigrationConfig migrationConfig)
public String getDataTimeZone()
When set a Calendar object is used in JDBC calls when reading/writing Timestamp objects.
public void setDataTimeZone(String dataTimeZone)
public String getAsOfViewSuffix()
public void setAsOfViewSuffix(String asOfViewSuffix)
public String getAsOfSysPeriod()
public void setAsOfSysPeriod(String asOfSysPeriod)
public String getHistoryTableSuffix()
public void setHistoryTableSuffix(String historyTableSuffix)
public boolean isUseJtaTransactionManager()
public void setUseJtaTransactionManager(boolean useJtaTransactionManager)
public ExternalTransactionManager getExternalTransactionManager()
public void setExternalTransactionManager(ExternalTransactionManager externalTransactionManager)
public ServerCachePlugin getServerCachePlugin()
public void setServerCachePlugin(ServerCachePlugin serverCachePlugin)
public ServerCacheManager getServerCacheManager()
public void setServerCacheManager(ServerCacheManager serverCacheManager)
public boolean isEagerFetchLobs()
public void setEagerFetchLobs(boolean eagerFetchLobs)
public int getMaxCallStack()
public void setMaxCallStack(int maxCallStack)
public boolean isTransactionRollbackOnChecked()
public void setTransactionRollbackOnChecked(boolean transactionRollbackOnChecked)
public int getBackgroundExecutorSchedulePoolSize()
public void setBackgroundExecutorSchedulePoolSize(int backgroundExecutorSchedulePoolSize)
public int getBackgroundExecutorShutdownSecs()
public void setBackgroundExecutorShutdownSecs(int backgroundExecutorShutdownSecs)
public int getCacheMaxSize()
public void setCacheMaxSize(int cacheMaxSize)
public int getCacheMaxIdleTime()
public void setCacheMaxIdleTime(int cacheMaxIdleTime)
public int getCacheMaxTimeToLive()
public void setCacheMaxTimeToLive(int cacheMaxTimeToLive)
public int getQueryCacheMaxSize()
public void setQueryCacheMaxSize(int queryCacheMaxSize)
public int getQueryCacheMaxIdleTime()
public void setQueryCacheMaxIdleTime(int queryCacheMaxIdleTime)
public int getQueryCacheMaxTimeToLive()
public void setQueryCacheMaxTimeToLive(int queryCacheMaxTimeToLive)
public NamingConvention getNamingConvention()
If none has been set the default UnderscoreNamingConvention is used.
public void setNamingConvention(NamingConvention namingConvention)
If none is set the default UnderscoreNamingConvention is used.
public DocStoreConfig getDocStoreConfig()
public void setDocStoreConfig(DocStoreConfig docStoreConfig)
public DbConstraintNaming getConstraintNaming()
public void setConstraintNaming(DbConstraintNaming constraintNaming)
public AutoTuneConfig getAutoTuneConfig()
public void setAutoTuneConfig(AutoTuneConfig autoTuneConfig)
public DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public org.avaje.datasource.DataSourceConfig getDataSourceConfig()
public void setDataSourceConfig(org.avaje.datasource.DataSourceConfig dataSourceConfig)
public String getDataSourceJndiName()
public void setDataSourceJndiName(String dataSourceJndiName)
By default a prefix of "java:comp/env/jdbc/" is used to lookup the DataSource. This prefix is not used if dataSourceJndiName starts with "java:".
public boolean isAutoCommitMode()
public void setAutoCommitMode(boolean autoCommitMode)
public boolean isExplicitTransactionBeginMode()
public void setExplicitTransactionBeginMode(boolean explicitTransactionBeginMode)
This works for H2 and Postgres but not for Oracle - only use this if you first name is Daryl or you have explicitly talked to Rob about this feature.
This is generally not expected to be turned on but instead allow transactions to start implicitly which is generally the standard approach.
public String getDatabaseBooleanTrue()
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").
public void setDatabaseBooleanTrue(String databaseTrue)
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").
public String getDatabaseBooleanFalse()
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").
public void setDatabaseBooleanFalse(String databaseFalse)
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").
public int getDatabaseSequenceBatchSize()
public void setDatabaseSequenceBatch(int databaseSequenceBatchSize)
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.
public String getDatabasePlatformName()
If null then the platform is determined automatically via the JDBC driver information.
public void setDatabasePlatformName(String databasePlatformName)
If 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, mssqlserver2005.
public DatabasePlatform getDatabasePlatform()
public void setDatabasePlatform(DatabasePlatform databasePlatform)
If none is set then the platform is determined via the databasePlatformName or automatically via the JDBC driver information.
public EncryptKeyManager getEncryptKeyManager()
public void setEncryptKeyManager(EncryptKeyManager 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=com.avaje.tests.basic.encrypt.BasicEncyptKeyManager
public EncryptDeployManager getEncryptDeployManager()
This is optionally used to programmatically define which columns are
encrypted instead of using the Encrypted Annotation.
public void setEncryptDeployManager(EncryptDeployManager encryptDeployManager)
This is optionally used to programmatically define which columns are
encrypted instead of using the Encrypted Annotation.
public Encryptor getEncryptor()
public void setEncryptor(Encryptor encryptor)
Ebean has a default implementation that it will use if you do not set your own Encryptor implementation.
public DbEncrypt getDbEncrypt()
Note that if this is not set then the DbPlatform may already have a DbEncrypt set and that will be used.
public void setDbEncrypt(DbEncrypt dbEncrypt)
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)
public ServerConfig.DbUuid getDbUuid()
public void setDbUuid(ServerConfig.DbUuid dbUuid)
public boolean isLocalTimeWithNanos()
public void setLocalTimeWithNanos(boolean localTimeWithNanos)
Otherwise it is persisted using java.sql.Time which is seconds precision.
public boolean isDurationWithNanos()
Otherwise it is persisted with second precision (SQL INTEGER).
public void setDurationWithNanos(boolean durationWithNanos)
Otherwise it is persisted with second precision (SQL INTEGER).
public void setDdlGenerate(boolean ddlGenerate)
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.
public void setDdlRun(boolean ddlRun)
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.
public boolean isDdlCreateOnly()
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.
public void setDdlCreateOnly(boolean ddlCreateOnly)
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.
public String getDdlSeedSql()
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.
public void setDdlSeedSql(String ddlSeedSql)
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.
public String getDdlInitSql()
public void setDdlInitSql(String ddlInitSql)
public boolean isDdlGenerate()
public boolean isDdlRun()
public boolean isDisableClasspathSearch()
public void setDisableClasspathSearch(boolean disableClasspathSearch)
public String getJodaLocalTimeMode()
public void setJodaLocalTimeMode(String jodaLocalTimeMode)
public void addClass(Class<?> cls)
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.
Alternatively the classes can be added via setClasses(List).
cls - the entity type (or other type) that should be registered by this
server.public void addPackage(String packageName)
This is only used if classes have not been explicitly specified.
public List<String> getPackages()
This is only used if classes have not been explicitly specified.
public void setPackages(List<String> packages)
This is only used if classes have not been explicitly specified.
public void setClasses(List<Class<?>> classes)
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).
public List<Class<?>> getClasses()
public boolean isSkipCacheAfterWrite()
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 ...
Transaction transaction = Ebean.beginTransaction();
try {
// 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
Ebean.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
} finally {
transaction.end();
}
Transaction.setSkipCache(boolean)public void setSkipCacheAfterWrite(boolean skipCacheAfterWrite)
public boolean isUpdateChangesOnly()
public void setUpdateChangesOnly(boolean updateChangesOnly)
public boolean isUpdateAllPropertiesInBatch()
public void setUpdateAllPropertiesInBatch(boolean updateAllPropertiesInBatch)
This mode can be explicitly set per transaction.
public boolean isUpdatesDeleteMissingChildren()
public void setUpdatesDeleteMissingChildren(boolean updatesDeleteMissingChildren)
public boolean isCollectQueryStatsByNode()
public void setCollectQueryStatsByNode(boolean collectQueryStatsByNode)
These statistics can be used to highlight code/query 'origin points' that result in lots of lazy loading.
It is considered safe/fine to have this set to true for production.
This information can be later retrieved via MetaInfoManager.
MetaInfoManagerpublic boolean isCollectQueryOrigins()
public void setCollectQueryOrigins(boolean collectQueryOrigins)
This information can be later retrieved via MetaInfoManager.
MetaInfoManagerpublic String getResourceDirectory()
public void setResourceDirectory(String resourceDirectory)
public void add(BeanQueryAdapter beanQueryAdapter)
Note alternatively you can use setQueryAdapters(List) to set all
the BeanQueryAdapter instances.
public List<BeanQueryAdapter> getQueryAdapters()
public void setQueryAdapters(List<BeanQueryAdapter> queryAdapters)
Note alternatively you can use add(BeanQueryAdapter) to add
BeanQueryAdapter instances one at a time.
public List<IdGenerator> getIdGenerators()
public void setIdGenerators(List<IdGenerator> idGenerators)
public void add(IdGenerator idGenerator)
public void add(BeanPersistController beanPersistController)
Note alternatively you can use setPersistControllers(List) to set
all the BeanPersistController instances.
public void add(BeanPostLoad postLoad)
Note alternatively you can use setPostLoaders(List) to set
all the BeanPostLoad instances.
public List<BeanFindController> getFindControllers()
public void setFindControllers(List<BeanFindController> findControllers)
public List<BeanPostLoad> getPostLoaders()
public void setPostLoaders(List<BeanPostLoad> postLoaders)
public List<BeanPersistController> getPersistControllers()
public void setPersistControllers(List<BeanPersistController> persistControllers)
Note alternatively you can use add(BeanPersistController) to add
BeanPersistController instances one at a time.
public void add(TransactionEventListener listener)
Note alternatively you can use setTransactionEventListeners(List)
to set all the TransactionEventListener instances.
public List<TransactionEventListener> getTransactionEventListeners()
public void setTransactionEventListeners(List<TransactionEventListener> transactionEventListeners)
Note alternatively you can use add(TransactionEventListener) to
add TransactionEventListener instances one at a time.
public void add(BeanPersistListener beanPersistListener)
Note alternatively you can use setPersistListeners(List) to set
all the BeanPersistListener instances.
public List<BeanPersistListener> getPersistListeners()
public void add(BulkTableEventListener bulkTableEventListener)
public List<BulkTableEventListener> getBulkTableEventListeners()
public void addServerConfigStartup(ServerConfigStartup configStartupListener)
public List<ServerConfigStartup> getServerConfigStartupListeners()
public void setPersistListeners(List<BeanPersistListener> persistListeners)
Note alternatively you can use add(BeanPersistListener) to add
BeanPersistListener instances one at a time.
public PersistenceContextScope getPersistenceContextScope()
.Query#setPersistenceContextScope(com.avaje.ebean.PersistenceContextScope). If it
is not set on the query this default scope is used.public void setPersistenceContextScope(PersistenceContextScope persistenceContextScope)
PersistenceContextScope.TRANSACTION.
The PersistenceContextScope can specified on each query via .Query#setPersistenceContextScope(com.avaje.ebean.PersistenceContextScope). If it
is not set on the query this scope is used.public ClassLoadConfig getClassLoadConfig()
public void setClassLoadConfig(ClassLoadConfig classLoadConfig)
public <T> ServiceLoader<T> serviceLoad(Class<T> spiService)
public <T> T service(Class<T> spiService)
public void loadFromProperties()
public void loadFromProperties(Properties properties)
public void loadTestProperties()
This is typically used when test-ebean.properties is put into the test class path and used to configure Ebean for running tests.
public Properties getProperties()
protected <T> T createInstance(PropertiesWrapper properties, Class<T> pluginType, String key, T instance)
properties - the propertiespluginType - the type of pluginkey - properties keyinstance - existing instanceprotected <T> T createInstance(Class<T> pluginType, String classname)
pluginType - the type of pluginclassname - the implementation class as per propertiesprotected void loadDataSourceSettings(PropertiesWrapper p)
p - - The defined property source passed to load settingsprotected void loadDocStoreSettings(PropertiesWrapper p)
protected void loadAutoTuneSettings(PropertiesWrapper p)
protected void loadSettings(PropertiesWrapper p)
public PersistBatch appliedPersistBatchOnCascade()
public Object getObjectMapper()
Note that this is not strongly typed as Jackson ObjectMapper is an optional dependency.
public void setObjectMapper(Object objectMapper)
Note that this is not strongly typed as Jackson ObjectMapper is an optional dependency.
public boolean isExpressionEqualsWithNullAsNoop()
public void setExpressionEqualsWithNullAsNoop(boolean expressionEqualsWithNullAsNoop)
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".
public boolean isExpressionNativeIlike()
public void setExpressionNativeIlike(boolean expressionNativeIlike)
public boolean isDisableL2Cache()
public void setDisableL2Cache(boolean disableL2Cache)
Copyright © 2016. All rights reserved.