Save This Page
Home » spring-framework-2.5.4 » org.springframework » jdbc » core » support » [javadoc | source]
org.springframework.jdbc.core.support
abstract public class: JdbcDaoSupport [javadoc | source]
java.lang.Object
   org.springframework.dao.support.DaoSupport
      org.springframework.jdbc.core.support.JdbcDaoSupport

All Implemented Interfaces:
    InitializingBean

Direct Known Subclasses:
    NamedParameterJdbcDaoSupport, SimpleJdbcDaoSupport

Convenient super class for JDBC-based data access objects.

Requires a javax.sql.DataSource to be set, providing a org.springframework.jdbc.core.JdbcTemplate 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.

Fields inherited from org.springframework.dao.support.DaoSupport:
logger
Method from org.springframework.jdbc.core.support.JdbcDaoSupport Summary:
checkDaoConfig,   createJdbcTemplate,   getConnection,   getDataSource,   getExceptionTranslator,   getJdbcTemplate,   initTemplateConfig,   releaseConnection,   setDataSource,   setJdbcTemplate
Methods from org.springframework.dao.support.DaoSupport:
afterPropertiesSet,   checkDaoConfig,   initDao
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.jdbc.core.support.JdbcDaoSupport Detail:
 protected  void checkDaoConfig() 
 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.

 protected final Connection getConnection() throws CannotGetJdbcConnectionException 
    Get a JDBC Connection, either from the current transaction or a new one.
 public final DataSource getDataSource() 
    Return the JDBC DataSource used by this DAO.
 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 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.

 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.
 public final  void setDataSource(DataSource dataSource) 
    Set the JDBC DataSource to be used by this DAO.
 public final  void setJdbcTemplate(JdbcTemplate jdbcTemplate) 
    Set the JdbcTemplate for this DAO explicitly, as an alternative to specifying a DataSource.