You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Jorge Perez <jp...@investran.com> on 2007/03/12 22:31:01 UTC

default parameter mapping for stored procedures

 

Hi, I have the following problem:

 

I have a stored procedure that takes 3 parameters.

 

CREATE Procedure [dbo].[spContactDelete] (@ContactID int, @Caller
varchar(128)=null, @Callerid int=0)

 

I want to map to the above stored procedure without using a hashTable.
In other words without doing this

 

<parameterMap id="OrganizationParameterMap"           class="HashTable">

      <parameter column="ContactID"       property="Id"
type="System.Int32"     />

      <parameter column="Caller"          property="Caller "
type="string"           />

      <parameter column="Callerid"        property="Callerid "
type="string"  />

</parameterMap>
 
I already have an object called Contact which has the ContactID
property, but does not have the other 2 parameters.  
Is there a way that I can just pass the contact object and have ibatis
use the default values? 
 
 
I would like to do something similar to this:
 

int recordsAffected =
mapper.Delete(statementNameBuilder.DeleteStatementName, contact);

 

 

 

thanks

CONFIDENTIALITY: This email (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited. If you received this email in error, please notify the sender and delete this email from your system. Thank you.

Re: default parameter mapping for stored procedures

Posted by Garth Keesler <ga...@gdcjk.com>.
Keep talking as I can be convinced. :-) Does this mean that all class 
variables are "?" style? "Int?" for example?

A sample class would be a big help.

Thanx,
Garth

Nguyen, Tom wrote:
> Depend on how you use it.  I find that it works great.
>
> I defined my class properties as nullable generic and map it as stored
> procedure parameters.
>
> Another thing I like about being able to do dynamic SQL is that I can
> call the stored procedure from dynamic SQL.
>
> Example: 
> <select ...>
> EXEC dbo.up_GetSomeValue #value#
> </select>
>
> It's not actually dynamic because I found during SQL Profiling that
> Ibatis convert this statement into:
>
> sql_execute 'EXEC dbo.up_GetSomeValue @param1', @param1 = N'blah blah'
>
> Regards,
>
>
> Tom Nguyen 
> Sr. Developer
> tom.nguyen@rels.info
> Rels Valuation
>
> -----Original Message-----
> From: Garth Keesler [mailto:garthk@gdcjk.com] 
> Sent: Wednesday, March 14, 2007 5:22 AM
> To: user-cs@ibatis.apache.org
> Subject: Re: default parameter mapping for stored procedures
>
> I agree. My experience with iBatisNet is that the support for stored 
> procedures isn't quite as "robust" as the counterpart in iBatis Java. I 
> finally quit trying to use that particular feature and instead code the 
> calls directly in c# functions.
>
> Not great but workable,
> Garth
>
> Gilles Bayon wrote:
>   
>> iBATIS doesn't support it.
>>
>> -- 
>> Cheers,
>> Gilles
>>     
>
> ************************************************************************************
> This e-mail message and any files transmitted herewith, are intended solely for the
> use of the individual(s) addressed and may contain confidential, proprietary or 
> privileged information.  If you are not the addressee indicated in this message 
> (or responsible for delivery of this message to such person) you may not review, 
> use, disclose or distribute this message or any files transmitted herewith.  If you 
> receive this message in error, please contact the sender by reply e-mail and delete
> this message and all copies of it from your system.
> ************************************************************************************
>
>
> .
>
>   


RE: default parameter mapping for stored procedures

Posted by "Nguyen, Tom" <To...@rels.info>.
Depend on how you use it.  I find that it works great.

I defined my class properties as nullable generic and map it as stored
procedure parameters.

Another thing I like about being able to do dynamic SQL is that I can
call the stored procedure from dynamic SQL.

Example: 
<select ...>
EXEC dbo.up_GetSomeValue #value#
</select>

It's not actually dynamic because I found during SQL Profiling that
Ibatis convert this statement into:

sql_execute 'EXEC dbo.up_GetSomeValue @param1', @param1 = N'blah blah'

Regards,


Tom Nguyen 
Sr. Developer
tom.nguyen@rels.info
Rels Valuation

-----Original Message-----
From: Garth Keesler [mailto:garthk@gdcjk.com] 
Sent: Wednesday, March 14, 2007 5:22 AM
To: user-cs@ibatis.apache.org
Subject: Re: default parameter mapping for stored procedures

I agree. My experience with iBatisNet is that the support for stored 
procedures isn't quite as "robust" as the counterpart in iBatis Java. I 
finally quit trying to use that particular feature and instead code the 
calls directly in c# functions.

Not great but workable,
Garth

Gilles Bayon wrote:
> iBATIS doesn't support it.
>
> -- 
> Cheers,
> Gilles

************************************************************************************
This e-mail message and any files transmitted herewith, are intended solely for the
use of the individual(s) addressed and may contain confidential, proprietary or 
privileged information.  If you are not the addressee indicated in this message 
(or responsible for delivery of this message to such person) you may not review, 
use, disclose or distribute this message or any files transmitted herewith.  If you 
receive this message in error, please contact the sender by reply e-mail and delete
this message and all copies of it from your system.
************************************************************************************

Re: default parameter mapping for stored procedures

Posted by Garth Keesler <ga...@gdcjk.com>.
I agree. My experience with iBatisNet is that the support for stored 
procedures isn't quite as "robust" as the counterpart in iBatis Java. I 
finally quit trying to use that particular feature and instead code the 
calls directly in c# functions.

Not great but workable,
Garth

Gilles Bayon wrote:
> iBATIS doesn't support it.
>
> -- 
> Cheers,
> Gilles


Re: default parameter mapping for stored procedures

Posted by Gilles Bayon <ib...@gmail.com>.
iBATIS doesn't support it.

-- 
Cheers,
Gilles