Requires a javax. to be set, providing a
org. based on it to
subclasses through the getJdbcTemplate() method.
This base class is mainly intended for JdbcTemplate usage but can
also be used when working with a Connection directly or when using
org.springframework.jdbc.object operation objects.
setDataSource, getJdbcTemplate, org.springframework.jdbc.core.JdbcTemplate
| Modifier and Type | Field and Description |
|---|---|
| private JdbcTemplate |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | checkDaoConfig()
Implements abstract org. Abstract subclasses must override this to check their configuration. |
| protected JdbcTemplate | Returns: the new JdbcTemplate instancethe JDBC DataSource to create a JdbcTemplate for dataSource)Create a JdbcTemplate for the given DataSource. |
| protected final Connection | Returns: the JDBC ConnectionGet a JDBC Connection, either from the current transaction or a new one. |
| public final DataSource | |
| protected final SQLExceptionTranslator | getExceptionTranslator()
Return the SQLExceptionTranslator of this DAO's JdbcTemplate, for translating SQLExceptions in custom JDBC access code. |
| public final JdbcTemplate | getJdbcTemplate()
Return the JdbcTemplate for this DAO, pre-initialized with the DataSource or set explicitly. |
| protected void | |
| protected final void | releaseConnection(Connection
the Connection to close con)Close the given JDBC Connection, created via this DAO's DataSource, if it isn't bound to the thread. |
| public final void | |
| public final void | setJdbcTemplate(JdbcTemplate jdbcTemplate)
Set the JdbcTemplate for this DAO explicitly, as an alternative to specifying a DataSource. |
| jdbcTemplate | back to summary |
|---|---|
| private JdbcTemplate jdbcTemplate
| |
| JdbcDaoSupport | back to summary |
|---|---|
| public JdbcDaoSupport() | |
| checkDaoConfig | back to summary |
|---|---|
| protected void checkDaoConfig() Implements abstract org. Doc from org. Abstract subclasses must override this to check their configuration. Implementors should be marked as
| |
| createJdbcTemplate | back to summary |
|---|---|
| protected JdbcTemplate createJdbcTemplate(DataSource dataSource) Create a JdbcTemplate for the given DataSource. Only invoked if populating the DAO with a DataSource reference! Can be overridden in subclasses to provide a JdbcTemplate instance with different configuration, or a custom JdbcTemplate subclass.
| |
| getConnection | back to summary |
|---|---|
| protected final Connection getConnection() throws CannotGetJdbcConnectionException Get a JDBC Connection, either from the current transaction or a new one.
| |
| getDataSource | back to summary |
|---|---|
| public final DataSource getDataSource() Return the JDBC DataSource used by this DAO.
| |
| getExceptionTranslator | back to summary |
|---|---|
| protected final SQLExceptionTranslator getExceptionTranslator() Return the SQLExceptionTranslator of this DAO's JdbcTemplate, for translating SQLExceptions in custom JDBC access code. | |
| getJdbcTemplate | back to summary |
|---|---|
| public final JdbcTemplate getJdbcTemplate() Return the JdbcTemplate for this DAO, pre-initialized with the DataSource or set explicitly.
| |
| initTemplateConfig | back to summary |
|---|---|
| protected void initTemplateConfig() Initialize the template-based configuration of this DAO. Called after a new JdbcTemplate has been set, either directly or through a DataSource. This implementation is empty. Subclasses may override this to configure further objects based on the JdbcTemplate.
| |
| releaseConnection | back to summary |
|---|---|
| protected final void releaseConnection(Connection con) Close the given JDBC Connection, created via this DAO's DataSource, if it isn't bound to the thread.
| |
| setDataSource | back to summary |
|---|---|
| public final void setDataSource(DataSource dataSource) Set the JDBC DataSource to be used by this DAO. | |
| setJdbcTemplate | back to summary |
|---|---|
| public final void setJdbcTemplate(JdbcTemplate jdbcTemplate) Set the JdbcTemplate for this DAO explicitly, as an alternative to specifying a DataSource. | |