org.springframework.orm.ibatis.support
Class SqlMapDaoSupport

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.ibatis.support.SqlMapDaoSupport
All Implemented Interfaces:
InitializingBean

public abstract class SqlMapDaoSupport
extends DaoSupport

Convenient super class for iBATIS SqlMap data access objects. Requires a SqlMap to be set, providing a SqlMapTemplate based on it to subclasses.

Instead of a plain SqlMap, you can also pass a preconfigured SqlMapTemplate instance in. This allows you to share your SqlMapTemplate configuration for all your DAOs, for example a custom SQLExceptionTranslator to use.

Since:
29.11.2003
Author:
Juergen Hoeller
See Also:
setSqlMap(com.ibatis.db.sqlmap.SqlMap), setSqlMapTemplate(org.springframework.orm.ibatis.SqlMapTemplate), SqlMapTemplate, JdbcAccessor.setExceptionTranslator(org.springframework.jdbc.support.SQLExceptionTranslator)

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
SqlMapDaoSupport()
           
 
Method Summary
protected  void checkDaoConfig()
          Abstract subclasses must override this to check their configuration.
 DataSource getDataSource()
          Return the JDBC DataSource used by this DAO.
 com.ibatis.db.sqlmap.SqlMap getSqlMap()
          Return the iBATIS Database Layer SqlMap that this template works with.
 SqlMapTemplate getSqlMapTemplate()
          Return the SqlMapTemplate for this DAO, pre-initialized with the SqlMap or set explicitly.
 void setDataSource(DataSource dataSource)
          Set the JDBC DataSource to be used by this DAO.
 void setSqlMap(com.ibatis.db.sqlmap.SqlMap sqlMap)
          Set the iBATIS Database Layer SqlMap to work with.
 void setSqlMapTemplate(SqlMapTemplate sqlMapTemplate)
          Set the SqlMapTemplate for this DAO explicitly, as an alternative to specifying a SqlMap.
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlMapDaoSupport

public SqlMapDaoSupport()
Method Detail

setDataSource

public final void setDataSource(DataSource dataSource)
Set the JDBC DataSource to be used by this DAO. Not required: The SqlMap might carry a shared DataSource.

See Also:
setSqlMap(com.ibatis.db.sqlmap.SqlMap)

getDataSource

public final DataSource getDataSource()
Return the JDBC DataSource used by this DAO.


setSqlMap

public final void setSqlMap(com.ibatis.db.sqlmap.SqlMap sqlMap)
Set the iBATIS Database Layer SqlMap to work with. Either this or a "sqlMapTemplate" is required.

See Also:
setSqlMapTemplate(org.springframework.orm.ibatis.SqlMapTemplate)

getSqlMap

public final com.ibatis.db.sqlmap.SqlMap getSqlMap()
Return the iBATIS Database Layer SqlMap that this template works with.


setSqlMapTemplate

public final void setSqlMapTemplate(SqlMapTemplate sqlMapTemplate)
Set the SqlMapTemplate for this DAO explicitly, as an alternative to specifying a SqlMap.

See Also:
setSqlMap(com.ibatis.db.sqlmap.SqlMap)

getSqlMapTemplate

public final SqlMapTemplate getSqlMapTemplate()
Return the SqlMapTemplate for this DAO, pre-initialized with the SqlMap or set explicitly.


checkDaoConfig

protected final void checkDaoConfig()
Description copied from class: DaoSupport
Abstract subclasses must override this to check their configuration.

Implementors should be marked as final, to make it clear that concrete subclasses are not supposed to override this template method themselves.

Specified by:
checkDaoConfig in class DaoSupport


Copyright (c) 2002-2007 The Spring Framework Project.