Module de.chojo.sadu.queries
Interface QueryConfiguration
- All Superinterfaces:
QueryConfiguration
- All Known Subinterfaces:
ActiveQueryConfiguration,ConnectedQueryConfiguration
- All Known Implementing Classes:
ActiveQueryConfigurationImpl,ConnectedQueryConfigurationImpl,ConnectedQueryQueryConfigurationDelegate,QueryConfigurationImpl
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanatomic()Retrieves the value of the atomic flag.static QueryConfigurationBuilderbuilder(DataSource source) Creates a new QueryConfigurationBuilder instance with the given DataSource.Returns the DataSource object associated with this QueryConfiguration.default QueryConfigurationBuilderedit()Returns a builder with the defaults being the settings of this configdefault QueryConfigurationBuilderedit(DataSource source) Returns a builder with the defaults being the settings of this configRetrieves the exception handlerforQuery(QueryContext context) Returns a new QueryConfiguration object with the provided query and other configuration settings.static QueryConfigurationRetrieves the default QueryConfiguration.Executes a SQL query with the given SQL statement and format arguments.Retrieves theRowMapperRegistryobject from the QueryConfiguration.static voidsetDefault(QueryConfiguration configuration) Sets the default query configuration.booleanRetrieves the value of the throwExceptions field.withConnection(Connection connection) Inject a connection into this configurationReturns a new instance of the ConnectedQueryConfiguration class with the "single transaction" configuration applied.
-
Field Details
-
DEFAULT
-
-
Method Details
-
getDefault
Retrieves the default QueryConfiguration.- Returns:
- the default QueryConfiguration
-
setDefault
Sets the default query configuration.- Parameters:
configuration- the query configuration to set as default
-
edit
Returns a builder with the defaults being the settings of this config- Parameters:
source- Overrides the current data source- Returns:
- new builder instance
-
edit
Returns a builder with the defaults being the settings of this config- Returns:
- new builder instance
-
builder
Creates a new QueryConfigurationBuilder instance with the given DataSource.- Parameters:
source- the DataSource to use for QueryConfiguration- Returns:
- a QueryConfigurationBuilder instance
-
forQuery
Returns a new QueryConfiguration object with the provided query and other configuration settings.- Specified by:
forQueryin interfaceQueryConfiguration- Parameters:
context- the query to be associated with the configuration- Returns:
- the new QueryConfiguration object
-
atomic
boolean atomic()Retrieves the value of the atomic flag.- Specified by:
atomicin interfaceQueryConfiguration- Returns:
trueif atomic flag is set;falseotherwise.
-
throwExceptions
boolean throwExceptions()Retrieves the value of the throwExceptions field.- Specified by:
throwExceptionsin interfaceQueryConfiguration- Returns:
- the value of the throwExceptions field
-
rowMapperRegistry
RowMapperRegistry rowMapperRegistry()Retrieves theRowMapperRegistryobject from the QueryConfiguration.- Specified by:
rowMapperRegistryin interfaceQueryConfiguration- Returns:
- The
RowMapperRegistryobject from the QueryConfiguration.
-
dataSource
DataSource dataSource()Returns the DataSource object associated with this QueryConfiguration.- Specified by:
dataSourcein interfaceQueryConfiguration- Returns:
- the DataSource object
-
exceptionHandler
Consumer<SQLException> exceptionHandler()Retrieves the exception handler- Returns:
- exception handler
-
query
Executes a SQL query with the given SQL statement and format arguments.- Specified by:
queryin interfaceQueryConfiguration- Parameters:
sql- the SQL statement to be executedformat- the format arguments to be applied to the SQL statement- Returns:
- a parsed query ready for execution
-
withSingleTransaction
ConnectedQueryConfigurationImpl withSingleTransaction()Returns a new instance of the ConnectedQueryConfiguration class with the "single transaction" configuration applied. This means that a single transaction will be used for the queries executed using this configuration.- Specified by:
withSingleTransactionin interfaceQueryConfiguration- Returns:
- A new instance of the ConnectedQueryConfiguration class with the "single transaction" configuration applied.
-
withConnection
Inject a connection into this configuration- Parameters:
connection- the connection to inject- Returns:
- new connected query configuration
-