<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Summer of NHibernate Session 10: SProcs, Interceptors, and NHQA is now available</title>
	<atom:link href="http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/feed/" rel="self" type="application/rss+xml" />
	<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/</link>
	<description>Miscellaneous musings on life, .NET development, and related things that don't really matter</description>
	<pubDate>Thu, 17 May 2012 21:14:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Recent Faves Tagged With "exceptions" : MyNetFaves</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-3878</link>
		<dc:creator>Recent Faves Tagged With "exceptions" : MyNetFaves</dc:creator>
		<pubDate>Mon, 03 Nov 2008 11:20:26 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-3878</guid>
		<description>[...] public links &#62;&#62; exceptions    Summer of NHibernate Session 10: SProcs, Interceptors, and NHQA is ... First saved by lifeoffthetube &#124; 1 days ago      SOAP, Web Services, and PHP First saved by [...]</description>
		<content:encoded><![CDATA[<p>[...] public links &gt;&gt; exceptions    Summer of NHibernate Session 10: SProcs, Interceptors, and NHQA is &#8230; First saved by lifeoffthetube | 1 days ago      SOAP, Web Services, and PHP First saved by [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nisar Khan</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-1158</link>
		<dc:creator>Nisar Khan</dc:creator>
		<pubDate>Tue, 09 Sep 2008 15:44:52 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-1158</guid>
		<description>oops my hbm.xml file wiped out  

i will try without '' 

&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"&#62;
  &#60;class name="DataTransfer.VisitInformation_SP,DataTransfer" table="`VISIT_INFORMATION`" lazy="true"&#62;
    &#60;id name="VisitInfoId" column="`visit_info_id`" type="int"&#62;
      &#60;generator class="native" /&#62;
    &#60;/id&#62;
     &#60;property type="string" not-null="true" length="4" name="le_fst_nm" column="`le_fst_nm`" /&#62;
    &#60;property type="string" not-null="true" name="le_mid_nm" column="`le_mid_nm`" /&#62;
    &#60;property type="string" not-null="true" name="le_last_nm" column="`le_last_nm`" /&#62;
    &#60;property type="string" not-null="true" length="4" name="visit_info_nm" column="`visit_info_nm`" /&#62;
    
  &#60;/class&#62; 
  &#60;sql-query name="visit_information_le_visit_le_name"&#62;
    &#60;return alias="visit_information" class="DataTransfer.VisitInformation,DataTransfer" /&#62;
    exec GetVisitorInformationByVisitInfoID :visit_info_id
  &#60;/sql-query&#62;

&#60;/hibernate-mapping&#62;</description>
		<content:encoded><![CDATA[<p>oops my hbm.xml file wiped out  </p>
<p>i will try without &#8221; </p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;hibernate-mapping xmlns=&#8221;urn:nhibernate-mapping-2.2&#8243;&gt;<br />
  &lt;class name=&#8221;DataTransfer.VisitInformation_SP,DataTransfer&#8221; table=&#8221;`VISIT_INFORMATION`&#8221; lazy=&#8221;true&#8221;&gt;<br />
    &lt;id name=&#8221;VisitInfoId&#8221; column=&#8221;`visit_info_id`&#8221; type=&#8221;int&#8221;&gt;<br />
      &lt;generator class=&#8221;native&#8221; /&gt;<br />
    &lt;/id&gt;<br />
     &lt;property type=&#8221;string&#8221; not-null=&#8221;true&#8221; length=&#8221;4&#8243; name=&#8221;le_fst_nm&#8221; column=&#8221;`le_fst_nm`&#8221; /&gt;<br />
    &lt;property type=&#8221;string&#8221; not-null=&#8221;true&#8221; name=&#8221;le_mid_nm&#8221; column=&#8221;`le_mid_nm`&#8221; /&gt;<br />
    &lt;property type=&#8221;string&#8221; not-null=&#8221;true&#8221; name=&#8221;le_last_nm&#8221; column=&#8221;`le_last_nm`&#8221; /&gt;<br />
    &lt;property type=&#8221;string&#8221; not-null=&#8221;true&#8221; length=&#8221;4&#8243; name=&#8221;visit_info_nm&#8221; column=&#8221;`visit_info_nm`&#8221; /&gt;</p>
<p>  &lt;/class&gt;<br />
  &lt;sql-query name=&#8221;visit_information_le_visit_le_name&#8221;&gt;<br />
    &lt;return alias=&#8221;visit_information&#8221; class=&#8221;DataTransfer.VisitInformation,DataTransfer&#8221; /&gt;<br />
    exec GetVisitorInformationByVisitInfoID :visit_info_id<br />
  &lt;/sql-query&gt;</p>
<p>&lt;/hibernate-mapping&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nisar Khan</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-1157</link>
		<dc:creator>Nisar Khan</dc:creator>
		<pubDate>Tue, 09 Sep 2008 15:41:24 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-1157</guid>
		<description>ok so far i found this:

but still unable to execute my method 

here is what i have done so far:

1) i have created my sp
2) created my hbm.xml file like this:



  
    
      
    
     
    
    
    
    
   
  
    
    exec GetVisitorInformationByVisitInfoID :visit_info_id
  



3) how would you execute SP?

i tried something like this:

    public IList VisitInformationByVisitInfoID_SP(int VisitId)
        {
            return _session.GetNamedQuery("visit_information_le_visit_le_name:VisitId");
        }

i know the above query throws an error but still trying to understand

anybody?</description>
		<content:encoded><![CDATA[<p>ok so far i found this:</p>
<p>but still unable to execute my method </p>
<p>here is what i have done so far:</p>
<p>1) i have created my sp<br />
2) created my hbm.xml file like this:</p>
<p>    exec GetVisitorInformationByVisitInfoID :visit_info_id</p>
<p>3) how would you execute SP?</p>
<p>i tried something like this:</p>
<p>    public IList VisitInformationByVisitInfoID_SP(int VisitId)<br />
        {<br />
            return _session.GetNamedQuery(&#8221;visit_information_le_visit_le_name:VisitId&#8221;);<br />
        }</p>
<p>i know the above query throws an error but still trying to understand</p>
<p>anybody?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nisar Khan</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-1091</link>
		<dc:creator>Nisar Khan</dc:creator>
		<pubDate>Mon, 08 Sep 2008 19:01:26 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-1091</guid>
		<description>what would you do for Select ?

 exec CustomerInsert ?,?,?,?
    exec CustomerUpdate ?, ?, ? ,?, ?
    exec CustomerDelete ?, ?

NHib does not provide for Get ?</description>
		<content:encoded><![CDATA[<p>what would you do for Select ?</p>
<p> exec CustomerInsert ?,?,?,?<br />
    exec CustomerUpdate ?, ?, ? ,?, ?<br />
    exec CustomerDelete ?, ?</p>
<p>NHib does not provide for Get ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nisar Khan</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-1084</link>
		<dc:creator>Nisar Khan</dc:creator>
		<pubDate>Mon, 08 Sep 2008 18:45:23 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-1084</guid>
		<description>@Mrunal Buch: 

i'm on the same boat now :) can you please give more detail on how did you able to use named-query from your class? snippet will be the good.

thanks.</description>
		<content:encoded><![CDATA[<p>@Mrunal Buch: </p>
<p>i&#8217;m on the same boat now <img src='http://unhandled-exceptions.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> can you please give more detail on how did you able to use named-query from your class? snippet will be the good.</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sbohlen</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-829</link>
		<dc:creator>sbohlen</dc:creator>
		<pubDate>Wed, 03 Sep 2008 23:37:20 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-829</guid>
		<description>@Mrunal:

Sorry about sending you on a wild goose chase there re: the SELECT new MyClass(...) idea -- that won't work for calling a sproc; I seem to have conflated two separate issues in my reply.

Glad you got it working otherwise; sorry for the misdirection there; lost my head :)</description>
		<content:encoded><![CDATA[<p>@Mrunal:</p>
<p>Sorry about sending you on a wild goose chase there re: the SELECT new MyClass(&#8230;) idea &#8212; that won&#8217;t work for calling a sproc; I seem to have conflated two separate issues in my reply.</p>
<p>Glad you got it working otherwise; sorry for the misdirection there; lost my head <img src='http://unhandled-exceptions.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mrunal Buch</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-798</link>
		<dc:creator>Mrunal Buch</dc:creator>
		<pubDate>Wed, 03 Sep 2008 07:35:58 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-798</guid>
		<description>Hi, Steve

Greetings and thanks for the prompt reply.

Well, it actually worked, but with some minor changes

I was able to execute a stored procedure (listed below) by using the named-query syntax

Stored-Proc
***********

CREATE PROCEDURE [dbo].[GetCustomerByFirstNameAndLastName] 
	@Firstname varchar(50),
	@Lastname varchar(50)
AS
BEGIN
	
	select * from Customer where Firstname=@Firstname And Lastname=@Lastname

END



Customer.hbm.xml
****************


    
      
      
        
        
      
      
    
    exec GetCustomerByFirstNameAndLastName :Firstname, :Lastname
  



it uses  rather than  as I was getting some weird error when using . I googled and came to know that one should use . Is this what you suggested ? or this is compeltly a different approach ?

I also got stuck when I tried to use the HQL syntax for executing stored procedures and could not figure out the way to implement the "SELECT new MyClass()...." sysntax. Help ?

Cheers and Thanks,</description>
		<content:encoded><![CDATA[<p>Hi, Steve</p>
<p>Greetings and thanks for the prompt reply.</p>
<p>Well, it actually worked, but with some minor changes</p>
<p>I was able to execute a stored procedure (listed below) by using the named-query syntax</p>
<p>Stored-Proc<br />
***********</p>
<p>CREATE PROCEDURE [dbo].[GetCustomerByFirstNameAndLastName]<br />
	@Firstname varchar(50),<br />
	@Lastname varchar(50)<br />
AS<br />
BEGIN</p>
<p>	select * from Customer where Firstname=@Firstname And Lastname=@Lastname</p>
<p>END</p>
<p>Customer.hbm.xml<br />
****************</p>
<p>    exec GetCustomerByFirstNameAndLastName :Firstname, :Lastname</p>
<p>it uses  rather than  as I was getting some weird error when using . I googled and came to know that one should use . Is this what you suggested ? or this is compeltly a different approach ?</p>
<p>I also got stuck when I tried to use the HQL syntax for executing stored procedures and could not figure out the way to implement the &#8220;SELECT new MyClass()&#8230;.&#8221; sysntax. Help ?</p>
<p>Cheers and Thanks,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sbohlen</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-755</link>
		<dc:creator>sbohlen</dc:creator>
		<pubDate>Tue, 02 Sep 2008 10:56:28 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-755</guid>
		<description>@Mrunal:

Thanks for the feedback; indeed I skipped over using sprocs to retrieve data and return objects.  This is actually pretty straightforward compared to INSERT, UPDATE, and DELETE so I skipped over it.

If you're interested in doing some research on how READS using sprocs work, here is the (high-level) overview:

NHibernate supports the concept in the mapping file(s) of 'named-queries'.  You can define a named query as any valid SQL statement for your target platform (e.g., T-SQL for MSSQL, pl/sql for ORA, etc.) so its perfectly legal for this to be an EXEC... statement that calls a sproc.

You then call that named query from the ISession instance and (usually) use AliasToBeanResultTransformer(...) to convert the resultset into your desired object(s).

AliasToResultBeanTransformer(...) is a function-name hold-over from the Java/Hibernate world where the original intent of the method was to return a fully-hydrated Enterprise Java Bean object ready to be used in your application.  It works on the assumption that your query will return a column name that correctly matches perfectly with the name of each property on your object/class and it just sets each property to the value from each column with a matching name (for more details, refer to the NHib docs on this method).

An alternate method if your sproc doesn't return cols with names that perfectly match the props on your class is to use the HQL-only strategy of doing a SELECT new MyClass(...) kind of statement to dynamically invoke the construction of your desired result object as I showed in either session 02 or 02a when returning my strongly-typed CustomerFirstnameCounter objects.

Hope this helps~!</description>
		<content:encoded><![CDATA[<p>@Mrunal:</p>
<p>Thanks for the feedback; indeed I skipped over using sprocs to retrieve data and return objects.  This is actually pretty straightforward compared to INSERT, UPDATE, and DELETE so I skipped over it.</p>
<p>If you&#8217;re interested in doing some research on how READS using sprocs work, here is the (high-level) overview:</p>
<p>NHibernate supports the concept in the mapping file(s) of &#8216;named-queries&#8217;.  You can define a named query as any valid SQL statement for your target platform (e.g., T-SQL for MSSQL, pl/sql for ORA, etc.) so its perfectly legal for this to be an EXEC&#8230; statement that calls a sproc.</p>
<p>You then call that named query from the ISession instance and (usually) use AliasToBeanResultTransformer(&#8230;) to convert the resultset into your desired object(s).</p>
<p>AliasToResultBeanTransformer(&#8230;) is a function-name hold-over from the Java/Hibernate world where the original intent of the method was to return a fully-hydrated Enterprise Java Bean object ready to be used in your application.  It works on the assumption that your query will return a column name that correctly matches perfectly with the name of each property on your object/class and it just sets each property to the value from each column with a matching name (for more details, refer to the NHib docs on this method).</p>
<p>An alternate method if your sproc doesn&#8217;t return cols with names that perfectly match the props on your class is to use the HQL-only strategy of doing a SELECT new MyClass(&#8230;) kind of statement to dynamically invoke the construction of your desired result object as I showed in either session 02 or 02a when returning my strongly-typed CustomerFirstnameCounter objects.</p>
<p>Hope this helps~!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mrunal Buch</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-747</link>
		<dc:creator>Mrunal Buch</dc:creator>
		<pubDate>Tue, 02 Sep 2008 08:23:31 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-747</guid>
		<description>Hi, Steve...

First of all a BIGGGG thanksss to you for these videos they really are wonderfulv(and I really hope that we have similar "Summer of " kinda stuff for other technologies. The video are to the point and really informative. 

A small request....The use of the stored procedures you just showed almost used INSERTS and UPDATES and DELETES. Can you please show a example of a stored proc that actually retrieves data and spit it back to the object that we created.

Thanks..</description>
		<content:encoded><![CDATA[<p>Hi, Steve&#8230;</p>
<p>First of all a BIGGGG thanksss to you for these videos they really are wonderfulv(and I really hope that we have similar &#8220;Summer of &#8221; kinda stuff for other technologies. The video are to the point and really informative. </p>
<p>A small request&#8230;.The use of the stored procedures you just showed almost used INSERTS and UPDATES and DELETES. Can you please show a example of a stored proc that actually retrieves data and spit it back to the object that we created.</p>
<p>Thanks..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Corey</title>
		<link>http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/comment-page-1/#comment-639</link>
		<dc:creator>Corey</dc:creator>
		<pubDate>Sat, 30 Aug 2008 19:59:04 +0000</pubDate>
		<guid isPermaLink="false">http://unhandled-exceptions.com/blog/index.php/2008/08/21/summer-of-nhibernate-session-10-sprocs-interceptors-and-nhqa-is-now-available/#comment-639</guid>
		<description>Yes the order that you pass the parameters should match nHibernate's ordering in the mapping file, but my suggestion would not require you to modify a sprocs parameter ordering to facilitate nHibnerate's needs.

So the question of is this valid using @CustomerId as the second parameter, no that would not be valid because nHibernate would require the last parameter to be @CustomerId.</description>
		<content:encoded><![CDATA[<p>Yes the order that you pass the parameters should match nHibernate&#8217;s ordering in the mapping file, but my suggestion would not require you to modify a sprocs parameter ordering to facilitate nHibnerate&#8217;s needs.</p>
<p>So the question of is this valid using @CustomerId as the second parameter, no that would not be valid because nHibernate would require the last parameter to be @CustomerId.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

