Class AbstractJpaProperties
- All Implemented Interfaces:
Serializable
,CasFeatureModule
- Direct Known Subclasses:
AuditJdbcProperties
,BaseJdbcAuthenticationProperties
,JdbcAcceptableUsagePolicyProperties
,JdbcMonitorProperties
,JdbcPasswordManagementProperties
,JdbcPrincipalAttributesProperties
,JdbcSecurityActuatorEndpointsMonitorProperties
,JdbcThrottleProperties
,JpaConsentProperties
,JpaEventsProperties
,JpaGoogleAuthenticatorMultifactorProperties
,JpaOidcJsonWebKeystoreProperties
,JpaSamlMetadataProperties
,JpaServiceRegistryProperties
,JpaTicketRegistryProperties
,JpaTrustedDevicesMultifactorProperties
,Pac4jSamlServiceProviderMetadataJdbcProperties
,PasswordlessAuthenticationJpaTokensProperties
,SurrogateJdbcAuthenticationProperties
,UmaResourceSetJpaProperties
,WebAuthnJpaMultifactorProperties
,YubiKeyJpaMultifactorProperties
- Since:
- 5.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apereo.cas.configuration.features.CasFeatureModule
CasFeatureModule.FeatureCatalog
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
A non-zero value enables use of JDBC2 batch updates by Hibernate.Attempts to do a JNDI data source look up for the data source name specified.Hibernate feature to automatically validate and exports DDL to the schema.Qualifies unqualified table names with the given catalog in generated SQL.Qualify unqualified table names with the given schema/tablespace in generated SQL.The database dialect is a configuration setting for platform independent software (JPA, Hibernate, etc) which allows such software to translate its generic SQL statements into vendor specific DDL, DML.The JDBC driver used to connect to the database.long
Set the pool initialization failure timeout.int
Used to specify number of rows to be fetched in a select query.The SQL query to be executed to test the validity of connections.Controls the maximum amount of time that a connection is allowed to sit idle in the pool.Defines the isolation level for transactions.Controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak.The database connection password.Fully-qualified name of the class that can control the physical naming strategy of hibernate.getPool()
Database connection pooling settings.Defines the propagation behavior for transactions.Additional settings provided by Hibernate (or the connection provider) in form of key-value pairs.getUrl()
The database connection URL.getUser()
The database user.boolean
The default auto-commit behavior of connections in the pool.boolean
Allow hibernate to generate query statistics.boolean
This property determines whether data source isolates internal pool queries, such as the connection alive test, in their own transaction.boolean
Configures the Connections to be added to the pool as read-only Connections.setAutocommit
(boolean autocommit) The default auto-commit behavior of connections in the pool.setBatchSize
(int batchSize) A non-zero value enables use of JDBC2 batch updates by Hibernate.setDataSourceName
(String dataSourceName) Attempts to do a JNDI data source look up for the data source name specified.setDdlAuto
(String ddlAuto) Hibernate feature to automatically validate and exports DDL to the schema.setDefaultCatalog
(String defaultCatalog) Qualifies unqualified table names with the given catalog in generated SQL.setDefaultSchema
(String defaultSchema) Qualify unqualified table names with the given schema/tablespace in generated SQL.setDialect
(String dialect) The database dialect is a configuration setting for platform independent software (JPA, Hibernate, etc) which allows such software to translate its generic SQL statements into vendor specific DDL, DML.setDriverClass
(String driverClass) The JDBC driver used to connect to the database.setFailFastTimeout
(long failFastTimeout) Set the pool initialization failure timeout.setFetchSize
(int fetchSize) Used to specify number of rows to be fetched in a select query.setGenerateStatistics
(boolean generateStatistics) Allow hibernate to generate query statistics.setHealthQuery
(String healthQuery) The SQL query to be executed to test the validity of connections.setIdleTimeout
(String idleTimeout) Controls the maximum amount of time that a connection is allowed to sit idle in the pool.setIsolateInternalQueries
(boolean isolateInternalQueries) This property determines whether data source isolates internal pool queries, such as the connection alive test, in their own transaction.setIsolationLevelName
(String isolationLevelName) Defines the isolation level for transactions.setLeakThreshold
(String leakThreshold) Controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak.setPassword
(String password) The database connection password.setPhysicalNamingStrategyClassName
(String physicalNamingStrategyClassName) Fully-qualified name of the class that can control the physical naming strategy of hibernate.Database connection pooling settings.setPropagationBehaviorName
(String propagationBehaviorName) Defines the propagation behavior for transactions.setProperties
(Map<String, String> properties) Additional settings provided by Hibernate (or the connection provider) in form of key-value pairs.setReadOnly
(boolean readOnly) Configures the Connections to be added to the pool as read-only Connections.The database connection URL.The database user.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apereo.cas.configuration.features.CasFeatureModule
isDefined, isUndefined
-
Constructor Details
-
AbstractJpaProperties
public AbstractJpaProperties()
-
-
Method Details
-
getDialect
The database dialect is a configuration setting for platform independent software (JPA, Hibernate, etc) which allows such software to translate its generic SQL statements into vendor specific DDL, DML. -
getDdlAuto
Hibernate feature to automatically validate and exports DDL to the schema. By default, creates and drops the schema automatically when a session is starts and ends. Setting the value tovalidate
ornone
may be more desirable for production, but any of the following options can be used:validate
: Validate the schema, but make no changes to the database.update
: Update the schema.create
: Create the schema, destroying previous data.create-drop
: Drop the schema at the end of the session.none
: Do nothing.
Note that during a version migration where any schema has changed
For more info, see this.create-drop
will result in the loss of all data as soon as CAS is started. For transient data like tickets this is probably not an issue, but in cases like the audit table important data could be lost. Using `update`, while safe for data, is confirmed to result in invalid database state.validate
ornone
settings are likely the only safe options for production use. -
getDriverClass
The JDBC driver used to connect to the database. -
getUrl
The database connection URL. -
getUser
The database user.The database user must have sufficient permissions to be able to handle schema changes and updates, when needed.
-
getPassword
The database connection password. -
getDefaultCatalog
Qualifies unqualified table names with the given catalog in generated SQL. -
getDefaultSchema
Qualify unqualified table names with the given schema/tablespace in generated SQL. -
getHealthQuery
The SQL query to be executed to test the validity of connections. This is for "legacy" databases that do not support the JDBC4Connection.isValid()
API. -
getIdleTimeout
Controls the maximum amount of time that a connection is allowed to sit idle in the pool. -
getDataSourceName
Attempts to do a JNDI data source look up for the data source name specified. Will attempt to locate the data source object as is. -
getProperties
Additional settings provided by Hibernate (or the connection provider) in form of key-value pairs. -
getPool
Database connection pooling settings. -
getLeakThreshold
Controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak. -
isGenerateStatistics
public boolean isGenerateStatistics()Allow hibernate to generate query statistics. -
getBatchSize
public int getBatchSize()A non-zero value enables use of JDBC2 batch updates by Hibernate. e.g. recommended values between 5 and 30. -
getFetchSize
public int getFetchSize()Used to specify number of rows to be fetched in a select query. -
getFailFastTimeout
public long getFailFastTimeout()Set the pool initialization failure timeout.- Any value greater than zero will be treated as a timeout for pool initialization.
The calling thread will be blocked from continuing until a successful connection
to the database, or until the timeout is reached. If the timeout is reached, then
a
PoolInitializationException
will be thrown. - A value of zero will not prevent the pool from starting in the
case that a connection cannot be obtained. However, upon start the pool will
attempt to obtain a connection and validate that the
connectionTestQuery
andconnectionInitSql
are valid. If those validations fail, an exception will be thrown. If a connection cannot be obtained, the validation is skipped and the the pool will start and continue to try to obtain connections in the background. This can mean that callers toDataSource#getConnection()
may encounter exceptions. - A value less than zero will not bypass any connection attempt and
validation during startup, and therefore the pool will start immediately. The
pool will continue to try to obtain connections in the background. This can mean
that callers to
DataSource#getConnection()
may encounter exceptions.
connectionTimeout
orvalidationTimeout
; they will be honored before this timeout is applied. The default value is one millisecond. - Any value greater than zero will be treated as a timeout for pool initialization.
The calling thread will be blocked from continuing until a successful connection
to the database, or until the timeout is reached. If the timeout is reached, then
a
-
isIsolateInternalQueries
public boolean isIsolateInternalQueries()This property determines whether data source isolates internal pool queries, such as the connection alive test, in their own transaction.Since these are typically read-only queries, it is rarely necessary to encapsulate them in their own transaction. This property only applies if
autocommit
is disabled. -
isAutocommit
public boolean isAutocommit()The default auto-commit behavior of connections in the pool. Determined whether queries such as update/insert should be immediately executed without waiting for an underlying transaction. -
isReadOnly
public boolean isReadOnly()Configures the Connections to be added to the pool as read-only Connections. -
getPhysicalNamingStrategyClassName
Fully-qualified name of the class that can control the physical naming strategy of hibernate. -
getIsolationLevelName
Defines the isolation level for transactions.- See Also:
-
getPropagationBehaviorName
Defines the propagation behavior for transactions.- See Also:
-
setDialect
The database dialect is a configuration setting for platform independent software (JPA, Hibernate, etc) which allows such software to translate its generic SQL statements into vendor specific DDL, DML.- Returns:
this
.
-
setDdlAuto
Hibernate feature to automatically validate and exports DDL to the schema. By default, creates and drops the schema automatically when a session is starts and ends. Setting the value tovalidate
ornone
may be more desirable for production, but any of the following options can be used:validate
: Validate the schema, but make no changes to the database.update
: Update the schema.create
: Create the schema, destroying previous data.create-drop
: Drop the schema at the end of the session.none
: Do nothing.
Note that during a version migration where any schema has changed
For more info, see this.create-drop
will result in the loss of all data as soon as CAS is started. For transient data like tickets this is probably not an issue, but in cases like the audit table important data could be lost. Using `update`, while safe for data, is confirmed to result in invalid database state.validate
ornone
settings are likely the only safe options for production use.- Returns:
this
.
-
setDriverClass
The JDBC driver used to connect to the database.- Returns:
this
.
-
setUrl
The database connection URL.- Returns:
this
.
-
setUser
The database user.The database user must have sufficient permissions to be able to handle schema changes and updates, when needed.
- Returns:
this
.
-
setPassword
The database connection password.- Returns:
this
.
-
setDefaultCatalog
Qualifies unqualified table names with the given catalog in generated SQL.- Returns:
this
.
-
setDefaultSchema
Qualify unqualified table names with the given schema/tablespace in generated SQL.- Returns:
this
.
-
setHealthQuery
The SQL query to be executed to test the validity of connections. This is for "legacy" databases that do not support the JDBC4Connection.isValid()
API.- Returns:
this
.
-
setIdleTimeout
Controls the maximum amount of time that a connection is allowed to sit idle in the pool.- Returns:
this
.
-
setDataSourceName
Attempts to do a JNDI data source look up for the data source name specified. Will attempt to locate the data source object as is.- Returns:
this
.
-
setProperties
Additional settings provided by Hibernate (or the connection provider) in form of key-value pairs.- Returns:
this
.
-
setPool
Database connection pooling settings.- Returns:
this
.
-
setLeakThreshold
Controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak.- Returns:
this
.
-
setGenerateStatistics
Allow hibernate to generate query statistics.- Returns:
this
.
-
setBatchSize
A non-zero value enables use of JDBC2 batch updates by Hibernate. e.g. recommended values between 5 and 30.- Returns:
this
.
-
setFetchSize
Used to specify number of rows to be fetched in a select query.- Returns:
this
.
-
setFailFastTimeout
Set the pool initialization failure timeout.- Any value greater than zero will be treated as a timeout for pool initialization.
The calling thread will be blocked from continuing until a successful connection
to the database, or until the timeout is reached. If the timeout is reached, then
a
PoolInitializationException
will be thrown. - A value of zero will not prevent the pool from starting in the
case that a connection cannot be obtained. However, upon start the pool will
attempt to obtain a connection and validate that the
connectionTestQuery
andconnectionInitSql
are valid. If those validations fail, an exception will be thrown. If a connection cannot be obtained, the validation is skipped and the the pool will start and continue to try to obtain connections in the background. This can mean that callers toDataSource#getConnection()
may encounter exceptions. - A value less than zero will not bypass any connection attempt and
validation during startup, and therefore the pool will start immediately. The
pool will continue to try to obtain connections in the background. This can mean
that callers to
DataSource#getConnection()
may encounter exceptions.
connectionTimeout
orvalidationTimeout
; they will be honored before this timeout is applied. The default value is one millisecond.- Returns:
this
.
- Any value greater than zero will be treated as a timeout for pool initialization.
The calling thread will be blocked from continuing until a successful connection
to the database, or until the timeout is reached. If the timeout is reached, then
a
-
setIsolateInternalQueries
This property determines whether data source isolates internal pool queries, such as the connection alive test, in their own transaction.Since these are typically read-only queries, it is rarely necessary to encapsulate them in their own transaction. This property only applies if
autocommit
is disabled.- Returns:
this
.
-
setAutocommit
The default auto-commit behavior of connections in the pool. Determined whether queries such as update/insert should be immediately executed without waiting for an underlying transaction.- Returns:
this
.
-
setReadOnly
Configures the Connections to be added to the pool as read-only Connections.- Returns:
this
.
-
setPhysicalNamingStrategyClassName
public AbstractJpaProperties setPhysicalNamingStrategyClassName(String physicalNamingStrategyClassName) Fully-qualified name of the class that can control the physical naming strategy of hibernate.- Returns:
this
.
-
setIsolationLevelName
Defines the isolation level for transactions.- Returns:
this
.- See Also:
-
setPropagationBehaviorName
Defines the propagation behavior for transactions.- Returns:
this
.- See Also:
-