站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

SqlMapCallback (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.orm.ibatis
Interface SqlMapCallback


public interface SqlMapCallback

Callback interface for data access code that works on an iBATIS Database Layer MappedStatement. To be used with SqlMapTemplate's execute method, assumably often as anonymous classes within a method implementation.

NOTE: The SqlMap/MappedStatement API is the one to use with iBATIS SQL Maps 1.x. The SqlMapClient/SqlMapSession API is only available with SQL Maps 2.

Since:
28.11.2003
Author:
Juergen Hoeller
See Also:
SqlMapTemplate.execute(String, SqlMapCallback)

Method Summary
 Object doInMappedStatement(com.ibatis.db.sqlmap.MappedStatement stmt, Connection con)
          Gets called by SqlMapTemplate.execute with an active JDBC Connection.
 

Method Detail

doInMappedStatement

Object doInMappedStatement(com.ibatis.db.sqlmap.MappedStatement stmt,
                           Connection con)
                           throws SQLException
Gets called by SqlMapTemplate.execute with an active JDBC Connection. Does not need to care about the lifecycle of the Connection or handling transactions.

If called without a thread-bound JDBC transaction (initiated by DataSourceTransactionManager), the code will simply get executed on the underlying JDBC connection with its transactional semantics. If using a JTA-aware DataSource, the JDBC connection and thus the callback code will be transactional if a JTA transaction is active.

Allows for returning a result object created within the callback, i.e. a domain object or a collection of domain objects. Note that there's special support for single step actions: see SqlMapTemplate. A thrown RuntimeException is treated as application exception, it gets propagated to the caller of the template.

Parameters:
stmt - the iBATIS Database Layer mapped statement
con - the JDBC Connection to work on
Returns:
a result object, or null if none
Throws:
SQLException - if thrown by MappedStatement methods
See Also:
SqlMapTemplate.executeQueryForList(java.lang.String, java.lang.Object), SqlMapTemplate.executeQueryForMap(java.lang.String, java.lang.Object, java.lang.String), SqlMapTemplate.executeUpdate(java.lang.String, java.lang.Object), DataSourceTransactionManager


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