public interface Configuration extends Serializable
Essentially, the lifecycle of all objects in Configuration
is the
same. It corresponds to the lifecycle of a single Query
and its
rendering, variable binding, execution, and data fetching phases. This is
also reflected in the fact that ExecuteListener
objects are
re-created every time a Query
is executed
However, Configuration
/ Factory
may be reused for several
consecutive queries in a single thread, if the supplied
Connection
/ DataSource
allows this and if client
code can live with the possibility of stale state in
getData()
between executions
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection()
Retrieve the configured connection
If you configured a data source for this
Configuration (see
setDataSource(DataSource) ), then this may initialise a new
connection. |
Map<String,Object> |
getData()
Get all custom data from this
Configuration
This is custom data that was previously set to the configuration using
setData(String, Object) . |
Object |
getData(String key)
Get some custom data from this
Configuration
This is custom data that was previously set to the configuration using
setData(String, Object) . |
DataSource |
getDataSource()
Retrieve the configured data source
|
SQLDialect |
getDialect()
Retrieve the configured dialect
|
SchemaMapping |
getSchemaMapping()
Deprecated.
- 2.0.5 - Use
getSettings() instead |
Settings |
getSettings()
Retrieve the runtime configuration settings
|
void |
setConnection(Connection connection)
Set the configured connection
If you provide a JDBC connection to a jOOQ Factory, jOOQ will use that
connection for creating statements, but it will never call any of these
methods:
Connection.commit()
Connection.rollback()
Connection.close()
Use this constructor if you want to handle transactions directly on the
connection. |
Object |
setData(String key,
Object value)
Set some custom data to this
Configuration
Use custom data if you want to pass data to your custom QueryPart
or ExecuteListener objects to be made available at render, bind,
execution, fetch time. |
void |
setDataSource(DataSource datasource)
Set the configured data source
If you provide a JDBC data source to a jOOQ Factory, jOOQ will use that
data source for initialising connections, and creating statements.
|
SQLDialect getDialect()
DataSource getDataSource()
void setDataSource(DataSource datasource)
If you provide a JDBC data source to a jOOQ Factory, jOOQ will use that data source for initialising connections, and creating statements.
Use data sources if you want to run distributed transactions, such as
javax.transaction.UserTransaction
. If you provide jOOQ
factories with a data source, jOOQ will close()
all connections after query execution in order to return the
connection to the connection pool. If you do not use distributed
transactions, this will produce driver-specific behaviour at the end of
query execution at close()
invocation (e.g. a transaction
rollback). Use setConnection(Connection)
instead, to control the
connection's lifecycle.
Connection getConnection()
If you configured a data source for this Configuration
(see
setDataSource(DataSource)
), then this may initialise a new
connection.
void setConnection(Connection connection)
If you provide a JDBC connection to a jOOQ Factory, jOOQ will use that connection for creating statements, but it will never call any of these methods:
Use this constructor if you want to handle transactions directly on the connection.@Deprecated SchemaMapping getSchemaMapping()
getSettings()
insteadSettings getSettings()
Map<String,Object> getData()
Configuration
This is custom data that was previously set to the configuration using
setData(String, Object)
. Use custom data if you want to pass
data to your custom QueryPart
or ExecuteListener
objects
to be made available at render, bind, execution, fetch time.
See ExecuteListener
for more details.
null
ExecuteListener
Object getData(String key)
Configuration
This is custom data that was previously set to the configuration using
setData(String, Object)
. Use custom data if you want to pass
data to your custom QueryPart
or ExecuteListener
objects
to be made available at render, bind, execution, fetch time.
See ExecuteListener
for more details.
key
- A key to identify the custom datanull
if no such data is contained
in this Configuration
ExecuteListener
Object setData(String key, Object value)
Configuration
Use custom data if you want to pass data to your custom QueryPart
or ExecuteListener
objects to be made available at render, bind,
execution, fetch time.
Be sure that your custom data implements Serializable
if you want
to serialise this Configuration
or objects referencing this
Configuration
, e.g. your Record
types.
See ExecuteListener
for more details.
key
- A key to identify the custom datavalue
- The custom data or null
to unset the custom
datanull
if no data
was previously set for the given keyExecuteListener
Copyright © 2013. All Rights Reserved.