ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Bayon <ibatis....@gmail.com>
Subject Re: Output Parameters in Stored Procedures
Date Wed, 08 Feb 2006 19:59:40 GMT
You should use ExecuteInsert

/// <summary>
/// Execute an insert statement. Fill the parameter object with
/// the ouput parameters if any, also could return the insert generated key
/// </summary>
/// <param name="session">The session</param>
/// <param name="parameterObject">The parameter object used to fill the
/// <returns>Can return the insert generated key.</returns>
object ExecuteInsert(IDalSession session, object parameterObject );

Here a sample from Nunit test

Category category = new Category();
category.Name = "Mapping object relational";
sqlMap.Insert("InsertCategoryViaStoreProcedure", category);
Assert.AreEqual(1, category.Id );
<procedure id="InsertCategoryViaStoreProcedure" parameterMap="insert-params"

<parameterMap id="insert-params">
<parameter property="Id" column="Category_Id" dbType="Int" />
<parameter property="Name" column="Category_Name"/>
<parameter property="Guid" column="Category_Guid" dbType="UniqueIdentifier"
it is for SQL Server but you will find the same example for Oracle

View raw message