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 TypeMethodDescriptionboolean
atomic()
Retrieves the value of the atomic flag.static QueryConfigurationBuilder
builder
(DataSource source) Creates a new QueryConfigurationBuilder instance with the given DataSource.Returns the DataSource object associated with this QueryConfiguration.default QueryConfigurationBuilder
edit()
Returns a builder with the defaults being the settings of this configdefault QueryConfigurationBuilder
edit
(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 QueryConfiguration
Retrieves the default QueryConfiguration.Executes a SQL query with the given SQL statement and format arguments.Retrieves theRowMapperRegistry
object from the QueryConfiguration.static void
setDefault
(QueryConfiguration configuration) Sets the default query configuration.boolean
Retrieves 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:
forQuery
in 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:
atomic
in interfaceQueryConfiguration
- Returns:
true
if atomic flag is set;false
otherwise.
-
throwExceptions
boolean throwExceptions()Retrieves the value of the throwExceptions field.- Specified by:
throwExceptions
in interfaceQueryConfiguration
- Returns:
- the value of the throwExceptions field
-
rowMapperRegistry
RowMapperRegistry rowMapperRegistry()Retrieves theRowMapperRegistry
object from the QueryConfiguration.- Specified by:
rowMapperRegistry
in interfaceQueryConfiguration
- Returns:
- The
RowMapperRegistry
object from the QueryConfiguration.
-
dataSource
DataSource dataSource()Returns the DataSource object associated with this QueryConfiguration.- Specified by:
dataSource
in 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:
query
in 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:
withSingleTransaction
in 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
-