OK, this is in the User's Guide, but since you apparently did not read it, here it is again.
这在用户指南里提到过,但是既然你显然没有看过,这里复述一遍。
Stored procedures are supported via the <procedure> statement element. The following example shows how a stored procedure would be used with output parameters.
存储过程通过<procedure>元素来支持,下面的例子展示怎么样通过output参数来显示怎么使用存储过程。
<parameterMap id="swapParameters" class="map" >
<parameter property="email1" jdbcType="VARCHAR" javaType="java.lang.String" mode="INOUT"/>
<parameter property="email2" jdbcType="VARCHAR" javaType="java.lang.String" mode="INOUT"/>
</parameterMap>
<procedure id="swapEmailAddresses" parameterMap="swapParameters" >
{call swap_email_address (?, ?)}
</procedure>
Calling the above procedure would swap two email addresses between two columns (database table) and also in the parameter object (Map). The parameter object is only modified if the parameter mappings mode attribute is set to ?INOUT? or ?OUT?. Otherwise they are left unchanged. Obviously immutable parameter objects (e.g. String) cannot be modified.
调用上面的存储过程将交换表的两列和输入参数的map里的两个值。参数对象只有在设置位INOUT或OUT时,调换元素位置。否则他们保持不动,显然不便对象String时不能够改动的。
Note! Always be sure to use the standard JDBC stored procedure syntax. See the JDBC CallableStatement documentation for more information.
注意!总是确保使用标准的JDBC存储过程语法。看JDBC的CallableStatement文档获取更多内容。
What SqlMapClient Method Should I Use?
我应该用哪些SqlMapClient方法?
It depends. Here is some help...
那样看情况了,下面这些帮你作出选择...
If your procedure returns a result set (not a result set in an OUT parameter, but a result set from the procedure itself), then use queryForList() or queryForObject(). Use queryForList() if you expect more than one result object, or queryForObject() if you expect only one result Object.
如果存储过程返回一个Result Set(不是一个OUT参数,而是来自存储过程自身的Result Set),那么用queryForList()或者queryForObject().
当有多个结果对象时,用queryForList(),否则如果有一个结果对象,使用QueryForObject().
If your procedure returns a result set AND updates data, then you should also configure your <transactionManager> with the attribute commitRequired="true".
如果你的存储过程返回一个结果,并且更新了数据,那么你应该还要配置<transactionManager>,设置commitRequired="true"
If your procedure does not return result sets, or only returns result sets in OUT parameters, then use the update() method.
如果你的存储过程没有返回结果集,而是仅仅从OUT 参数返回结果集,那么用update()方法。