In fact, that same section specifies a workaround for using stored
procedures with output parameters:
"[...]If you still want to use these procedures you have to execute them via
session.Connection."

So, it's as easy as:
  var command = session.Connection.CreateCommand();
  var parameter = command.CreateParameter();
  parameter.Direction = ParameterDirection.Output;
  parameter.DbType = ...
  parameter.ParameterName = ...
  command.Parameters.Add(parameter);
  transaction.Enlist(command);
  command.ExecuteNonQuery();

It's the kind of thing you build a small helper for. It definitely doesn't
belong in the NHibernate codebase.

   Diego


2010/1/30 Fabio Maulo <[email protected]>

> Yes you are right... now is clear which is the good reason ;)  perhaps the
> same because we avoid the usage of SP LOL
>
> 2010/1/30 Diego Mijelshon <[email protected]>
>
> That a SP returning a single value, not an output parameter...
>>
>> 15.2.2.1: "...The procedure must return a result set. NHibernate will use
>> IDbCommand.ExecuteReader() to obtain the results."
>>
>>    Diego
>>
>>
>> On Sat, Jan 30, 2010 at 17:17, Fabio Maulo <[email protected]> wrote:
>>
>>> Mohamed, try to complete the answer with more context instead say what
>>> Diego should explain ;)
>>> btw I'm having some doubts about Diego's answer basically because this
>>> test should fail
>>> [Test]
>>>  public void ScalarStoredProcedure()
>>> {
>>> ISession s = OpenSession();
>>>  IQuery namedQuery = s.GetNamedQuery("simpleScalar");
>>> namedQuery.SetInt64("number", 43L);
>>>  IList list = namedQuery.List();
>>> object[] o = (object[])list[0];
>>> Assert.AreEqual(o[0], "getAll");
>>>  Assert.AreEqual(o[1], 43L);
>>> s.Close();
>>> }
>>> but with this mapping
>>> <sql-query name="simpleScalar">
>>> <return-scalar column="name" type="string"/>
>>>  <return-scalar column="value" type="long"/>
>>> exec simpleScalar :number
>>>  </sql-query>
>>> it is working
>>>
>>> 2010/1/30 Mohamed Meligy <[email protected]>
>>>
>>> No offense, but, specifically in the ALT.NET world, and more
>>>> specifically in NHibernate, isn't it too frequent to hear "this is not
>>>> supported" / "this is not the way it works" / ... followed by the other
>>>> sentence "FOR GOOD REASONS" or something equivalent?
>>>>
>>>> Was just thinking ...
>>>>
>>>> Regards,
>>>>
>>>> --
>>>> Mohamed Meligy
>>>> Senior Developer, Team Lead Backup (.Net Technologies - TDG -
>>>> Applications)
>>>> Injazat Data Systems
>>>> P.O. Box: 8230 Abu Dhabi, UAE.
>>>>
>>>> Phone:  +971 2 6992700
>>>> Direct:   +971 2 4045385
>>>> Mobile:  +971 50 2623624, +971 55 2017 621
>>>>
>>>> E-mail: [email protected]
>>>> Weblog: http://weblogs.asp.net/meligy
>>>>
>>>>
>>>>
>>>> On Sat, Jan 30, 2010 at 8:12 PM, Diego Mijelshon <
>>>> [email protected]> wrote:
>>>>
>>>>> Yes. And for good reasons.
>>>>>
>>>>>    Diego
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Jan 28, 2010 at 06:46, Asier <[email protected]>wrote:
>>>>>
>>>>>> Hello
>>>>>>
>>>>>> Is true that Nhibernate doesn’t support stored procedures output
>>>>>> parameters?
>>>>>> Thanks.
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "nhusers" group.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]<nhusers%[email protected]>
>>>>>> .
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>>
>>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "nhusers" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected]<nhusers%[email protected]>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nhusers" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected]<nhusers%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/nhusers?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> Fabio Maulo
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "nhusers" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<nhusers%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>
>
> --
> Fabio Maulo
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to