<?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: Does It Make Sense To Use NHibernate in a Sproc-Only Shop?</title>
	<atom:link href="http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/</link>
	<description>A Grande, Triple Shot, Non-Fat Core Dump by Russell Ball</description>
	<lastBuildDate>Thu, 11 Mar 2010 09:47:24 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mischa Kroon</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2155</link>
		<dc:creator>Mischa Kroon</dc:creator>
		<pubDate>Mon, 03 Aug 2009 09:36:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2155</guid>
		<description>I would probably just use a simple ORM. 
Subsonic comes to mind, I just wrote a post about it&#039;s Sproc support and how it might become better here:

http://bloggingabout.net/blogs/mischa/archive/2009/07/28/subsonic-dreams-stored-procedures-a-first-class-citizen.aspx</description>
		<content:encoded><![CDATA[<p>I would probably just use a simple ORM.<br />
Subsonic comes to mind, I just wrote a post about it&#8217;s Sproc support and how it might become better here:</p>
<p><a href="http://bloggingabout.net/blogs/mischa/archive/2009/07/28/subsonic-dreams-stored-procedures-a-first-class-citizen.aspx" rel="nofollow">http://bloggingabout.net/blogs.....tizen.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Willis</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2151</link>
		<dc:creator>Tom Willis</dc:creator>
		<pubDate>Sat, 01 Aug 2009 23:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2151</guid>
		<description>@Russel

It&#039;s hard to say which one would save you LOC. Going straight ADO.net has the &quot;benefit&quot; of being the standard though, so any code monkey can wrap their head around that or buy a book that shows how to do it. 

Effort might be better spent getting away from sprocs entirely :)</description>
		<content:encoded><![CDATA[<p>@Russel</p>
<p>It&#8217;s hard to say which one would save you LOC. Going straight ADO.net has the &#8220;benefit&#8221; of being the standard though, so any code monkey can wrap their head around that or buy a book that shows how to do it. </p>
<p>Effort might be better spent getting away from sprocs entirely <img src='http://www.caffeinatedcoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Ball</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2150</link>
		<dc:creator>Russell Ball</dc:creator>
		<pubDate>Sat, 01 Aug 2009 21:33:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2150</guid>
		<description>@Tom

Thanks for the detailed clarification. I definitely see how having to create 6 mapping files because you have an update, insert, delete, and 3 versions of a select is insanely more difficult than just having to worry about 1 table mapping. That&#039;s the beauty of using ORM&#039;s the way they were supposed to be used (without sprocs).

However, if you didn&#039;t use NHibernate and just used straight ADO.NET code instead, wouldn&#039;t you also have one ADO.NET method for each NHibernate sproc mapping file with basically the same input and output information (and in a slightly more verbose format based on how many data access helper methods you have)? In your experience, if you had to compare number of lines of code between an ADO.NET version and an NHibernate with sproc version, would you actually come out with more lines of code on the NHibernate side?</description>
		<content:encoded><![CDATA[<p>@Tom</p>
<p>Thanks for the detailed clarification. I definitely see how having to create 6 mapping files because you have an update, insert, delete, and 3 versions of a select is insanely more difficult than just having to worry about 1 table mapping. That&#8217;s the beauty of using ORM&#8217;s the way they were supposed to be used (without sprocs).</p>
<p>However, if you didn&#8217;t use NHibernate and just used straight ADO.NET code instead, wouldn&#8217;t you also have one ADO.NET method for each NHibernate sproc mapping file with basically the same input and output information (and in a slightly more verbose format based on how many data access helper methods you have)? In your experience, if you had to compare number of lines of code between an ADO.NET version and an NHibernate with sproc version, would you actually come out with more lines of code on the NHibernate side?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjan&#8217;s World &#187; LINKBLOG for August 1, 2009</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2149</link>
		<dc:creator>Arjan&#8217;s World &#187; LINKBLOG for August 1, 2009</dc:creator>
		<pubDate>Sat, 01 Aug 2009 21:09:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2149</guid>
		<description>[...] Does It Make Sense To Use NHibernate in a Sproc-Only Shop? - Russell Ball &#8216; my gut instinct says that you would loose about 90% of the benefits if you only ever used sprocs with NHibernate. However (&#8230;) &#8216; read on&#8230; [...]</description>
		<content:encoded><![CDATA[<p>[...] Does It Make Sense To Use NHibernate in a Sproc-Only Shop? &#8211; Russell Ball &#8216; my gut instinct says that you would loose about 90% of the benefits if you only ever used sprocs with NHibernate. However (&#8230;) &#8216; read on&#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Willis</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2147</link>
		<dc:creator>Tom Willis</dc:creator>
		<pubDate>Sat, 01 Aug 2009 14:50:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2147</guid>
		<description>Yeah IIRC named params had no effect, but surely they&#039;ve changed that by now.

What I meant by more work was that I had more to worry about in regards to the mapping. 

Not only did I have to pay attention to the table structure/columns etc.... but the inputs/outputs of each stored procedure. Which in a sense from the mapping standpoint could be thought of as another table. So essentially a class that would be mapped to one tableish entity now has to be mapped  N stored procedures   table. 

Ultimately what was needed was a convention for the stored procedures in terms of params and their names and what was returned. For example, you would need a sproc for fetching a single row by id at least, and there could be more select sprocs depending on your needs, each one would probably have to return a result set with the same columns/structure or you would likely drive yourself insane, and an update   insert sproc that would likely contain identical params probably matching up closely to the columns of the underlying table and a delete by id sproc. Now, if you need a new property which will map to a column in the underlying table what do you have to do?

1: add the column(regardless of whether sprocs were used)
2: change each select sproc(s) to include the new column in the result
3: change param signature for insert and update  
4: change mapped class(regardless of sprocs)

And as far as I can tell, the only tool you have to manage all that is your brain. I don&#039;t trust mine to handle all that. :)

Without sprocs you still have to do 1 and 4, introducing sprocs into the equation to me yields little or no benefit other than keeping some DBA employed, or slowing down development to the point where it can be managed by some pointy haired boss, and distracting the developer from the problem domain. 

Hope that explains things, this is strictly my point of view by the way, and runs the risk of your blog post being overrun by a religious war at this point. Apologies in advance.</description>
		<content:encoded><![CDATA[<p>Yeah IIRC named params had no effect, but surely they&#8217;ve changed that by now.</p>
<p>What I meant by more work was that I had more to worry about in regards to the mapping. </p>
<p>Not only did I have to pay attention to the table structure/columns etc&#8230;. but the inputs/outputs of each stored procedure. Which in a sense from the mapping standpoint could be thought of as another table. So essentially a class that would be mapped to one tableish entity now has to be mapped  N stored procedures   table. </p>
<p>Ultimately what was needed was a convention for the stored procedures in terms of params and their names and what was returned. For example, you would need a sproc for fetching a single row by id at least, and there could be more select sprocs depending on your needs, each one would probably have to return a result set with the same columns/structure or you would likely drive yourself insane, and an update   insert sproc that would likely contain identical params probably matching up closely to the columns of the underlying table and a delete by id sproc. Now, if you need a new property which will map to a column in the underlying table what do you have to do?</p>
<p>1: add the column(regardless of whether sprocs were used)<br />
2: change each select sproc(s) to include the new column in the result<br />
3: change param signature for insert and update<br />
4: change mapped class(regardless of sprocs)</p>
<p>And as far as I can tell, the only tool you have to manage all that is your brain. I don&#8217;t trust mine to handle all that. <img src='http://www.caffeinatedcoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Without sprocs you still have to do 1 and 4, introducing sprocs into the equation to me yields little or no benefit other than keeping some DBA employed, or slowing down development to the point where it can be managed by some pointy haired boss, and distracting the developer from the problem domain. </p>
<p>Hope that explains things, this is strictly my point of view by the way, and runs the risk of your blog post being overrun by a religious war at this point. Apologies in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Ball</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2146</link>
		<dc:creator>Russell Ball</dc:creator>
		<pubDate>Sat, 01 Aug 2009 13:51:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2146</guid>
		<description>@Tom

Thanks for the heads up about the issue related to param ordering. I&#039;m curious about that one so I&#039;ll play with it this weekend to see if either anything has changed or else there is a way around it (i.e. named parameters that make the order irrelevant).

I&#039;m a little confused about your second statement. How would NHibernate cause more work with regards to keeping your sprocs in sync with your source code. Wouldn&#039;t you also have to worry about that with regular ADO.NET code?</description>
		<content:encoded><![CDATA[<p>@Tom</p>
<p>Thanks for the heads up about the issue related to param ordering. I&#8217;m curious about that one so I&#8217;ll play with it this weekend to see if either anything has changed or else there is a way around it (i.e. named parameters that make the order irrelevant).</p>
<p>I&#8217;m a little confused about your second statement. How would NHibernate cause more work with regards to keeping your sprocs in sync with your source code. Wouldn&#8217;t you also have to worry about that with regular ADO.NET code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Willis</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2145</link>
		<dc:creator>Tom Willis</dc:creator>
		<pubDate>Sat, 01 Aug 2009 11:55:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2145</guid>
		<description>I don&#039;t know if this is still the case, but last year mapping properties to stored procedure params was a gamble due to having no control over the order of the params. 

I tried my darndest anyway and I think it ended up causing more work for me, not only did I have to keep ~4 stored procedures in sync with the table(s) now there was source code as well.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know if this is still the case, but last year mapping properties to stored procedure params was a gamble due to having no control over the order of the params. </p>
<p>I tried my darndest anyway and I think it ended up causing more work for me, not only did I have to keep ~4 stored procedures in sync with the table(s) now there was source code as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Batum</title>
		<link>http://www.caffeinatedcoder.com/does-it-make-sense-to-use-nhibernate-in-a-sproc-only-shop/comment-page-1/#comment-2143</link>
		<dc:creator>Paul Batum</dc:creator>
		<pubDate>Sat, 01 Aug 2009 03:05:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.caffeinatedcoder.com/?p=539#comment-2143</guid>
		<description>The fluent nhibernate automapper is for generating nhibernate mappings, not for right-to-left assignment stuff. You might be confusing it with Jimmy Bogard&#039;s project &quot;Automapper&quot; which has nothing to do with NH but is very useful for  reducing right-to-left assignment code.

That said, I&#039;m not sure if using NH with sprocs involves much right-to-left stuff. Ayende has a good post on the basics:

http://ayende.com/Blog/archive/2006/09/18/UsingNHibernateWithStoredProcedures.aspx</description>
		<content:encoded><![CDATA[<p>The fluent nhibernate automapper is for generating nhibernate mappings, not for right-to-left assignment stuff. You might be confusing it with Jimmy Bogard&#8217;s project &#8220;Automapper&#8221; which has nothing to do with NH but is very useful for  reducing right-to-left assignment code.</p>
<p>That said, I&#8217;m not sure if using NH with sprocs involves much right-to-left stuff. Ayende has a good post on the basics:</p>
<p><a href="http://ayende.com/Blog/archive/2006/09/18/UsingNHibernateWithStoredProcedures.aspx" rel="nofollow">http://ayende.com/Blog/archive.....dures.aspx</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
