| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.springframework.jdbc.support.JdbcAccessor | +--org.springframework.orm.ibatis.SqlMapClientTemplate
Helper class that simplifies data access via the SqlMapClient API of iBATIS
SQL Maps, and converts checked SQLExceptions into unchecked DataAccessExceptions,
following the org.springframework.dao exception hierarchy.
Uses the same SQLExceptionTranslator mechanism as JdbcTemplate.
The main method of this class executes a callback that implements a data access action. Furthermore, this class provides numerous convenience methods that mirror SqlMapExecutor's execution methods. See the SqlMapExecutor javadocs for details on those methods.
Needs a SqlMapClient to work on, passed in via the "sqlMapClient" property. Can additionally be configured with a DataSource for fetching Connections, although this is not necessary if a DataSource is specified for the SqlMapClient.
NOTE: The SqlMapClient/SqlMapSession API is the API of iBATIS SQL Maps 2. With SQL Maps 1.x, the SqlMap/MappedStatement API has to be used.
| Constructor Summary | |
SqlMapClientTemplate()Create a new SqlMapClientTemplate. | |
SqlMapClientTemplate(SqlMapClient sqlMapClient)Create a new SqlMapTemplate. | |
SqlMapClientTemplate(DataSource dataSource, SqlMapClient sqlMapClient)Create a new SqlMapTemplate. | |
| Method Summary | |
void | afterPropertiesSet() |
int | delete(String statementName, Object parameterObject) |
void | delete(String statementName, Object parameterObject, int requiredRowsAffected) |
Object | execute(SqlMapClientCallback action)Execute the given data access action on a SqlMapSession. |
List | executeWithListResult(SqlMapClientCallback action)Execute the given data access action on a SqlMapSession, expecting a List result. |
Map | executeWithMapResult(SqlMapClientCallback action)Execute the given data access action on a SqlMapSession, expecting a Map result. |
DataSource | getDataSource()If no DataSource specified, use SqlMapClient's DataSource. |
SqlMapClient | getSqlMapClient()Return the iBATIS Database Layer SqlMapClient that this template works with. |
Object | insert(String statementName, Object parameterObject) |
List | queryForList(String statementName, Object parameterObject) |
List | queryForList(String statementName, Object parameterObject, int skipResults, int maxResults) |
Map | queryForMap(String statementName, Object parameterObject, String keyProperty) |
Map | queryForMap(String statementName, Object parameterObject, String keyProperty, String valueProperty) |
Object | queryForObject(String statementName, Object parameterObject) |
Object | queryForObject(String statementName, Object parameterObject, Object resultObject) |
PaginatedList | queryForPaginatedList(String statementName, Object parameterObject, int pageSize) |
void | queryWithRowHandler(String statementName, Object parameterObject, RowHandler rowHandler) |
void | setSqlMapClient(SqlMapClient sqlMapClient)Set the iBATIS Database Layer SqlMapClient that defines the mapped statements. |
int | update(String statementName, Object parameterObject) |
void | update(String statementName, Object parameterObject, int requiredRowsAffected) |
| Methods inherited from class org.springframework.jdbc.support.JdbcAccessor |
getExceptionTranslator, isLazyInit, setDataSource, setExceptionTranslator, setLazyInit |
| Constructor Detail |
public SqlMapClientTemplate()
public SqlMapClientTemplate(SqlMapClient sqlMapClient)
public SqlMapClientTemplate(DataSource dataSource, SqlMapClient sqlMapClient)
| Method Detail |
public void afterPropertiesSet()
public int delete(String statementName, Object parameterObject)
throws org.springframework.dao.DataAccessException
public void delete(String statementName, Object parameterObject, int requiredRowsAffected)
throws org.springframework.dao.DataAccessException
public Object execute(SqlMapClientCallback action)
throws org.springframework.dao.DataAccessException
public List executeWithListResult(SqlMapClientCallback action)
throws org.springframework.dao.DataAccessException
public Map executeWithMapResult(SqlMapClientCallback action)
throws org.springframework.dao.DataAccessException
public DataSource getDataSource()
public SqlMapClient getSqlMapClient()
public Object insert(String statementName, Object parameterObject)
throws org.springframework.dao.DataAccessException
public List queryForList(String statementName, Object parameterObject)
throws org.springframework.dao.DataAccessException
public List queryForList(String statementName, Object parameterObject, int skipResults, int maxResults)
throws org.springframework.dao.DataAccessException
public Map queryForMap(String statementName, Object parameterObject, String keyProperty)
throws org.springframework.dao.DataAccessException
public Map queryForMap(String statementName, Object parameterObject, String keyProperty, String valueProperty)
throws org.springframework.dao.DataAccessException
public Object queryForObject(String statementName, Object parameterObject)
throws org.springframework.dao.DataAccessException
public Object queryForObject(String statementName, Object parameterObject, Object resultObject)
throws org.springframework.dao.DataAccessException
public PaginatedList queryForPaginatedList(String statementName, Object parameterObject, int pageSize)
throws org.springframework.dao.DataAccessException
public void queryWithRowHandler(String statementName, Object parameterObject, RowHandler rowHandler)
throws org.springframework.dao.DataAccessException
public void setSqlMapClient(SqlMapClient sqlMapClient)
public int update(String statementName, Object parameterObject)
throws org.springframework.dao.DataAccessException
public void update(String statementName, Object parameterObject, int requiredRowsAffected)
throws org.springframework.dao.DataAccessException
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||