<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Geospecialling &#187; nHibernate</title>
	<atom:link href="http://www.geospecialling.com/index.php/tag/nhibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geospecialling.com</link>
	<description>Being a (G)IS Developer...</description>
	<lastBuildDate>Thu, 26 Jan 2012 04:11:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>NHibernate 2.1 throws System.InvalidCastException on Oracle 10g R1 client</title>
		<link>http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/</link>
		<comments>http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 21:52:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[nHibernate]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/</guid>
		<description><![CDATA[When deploying an early build of an up and coming product on a customers machine I came across the following error: System.InvalidCastException: Unable to cast object of type &#8216;Oracle.DataAccess.Client.OracleConnection&#8217; to type &#8216;System.Data.Common.DbConnection&#8217; This was one of those awesome “doesn’t happen on any of my machine” errors.&#160; After some mucking around we determined that the client [...]]]></description>
			<content:encoded><![CDATA[<p>When deploying an early build of an up and coming product on a customers machine I came across the following error:</p>
<p><em>System.InvalidCastException: Unable to cast object of type &#8216;Oracle.DataAccess.Client.OracleConnection&#8217; to type &#8216;System.Data.Common.DbConnection&#8217; </em></p>
<p>This was one of those awesome “doesn’t happen on any of my machine” errors.&#160; After some mucking around we determined that the client machine was using the Oracle 10g&#160; R1 client.&#160; The machines and VMs here we used for testing were all running either 11g, or 10g R2.&#160; Doh!</p>
<p>The simple resolution to this was to modify the NHhibernate config and add the following property:</p>
<div>
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;hbm2ddl.keywords&quot;</span><span style="color: #0000ff">&gt;</span>none<span style="color: #0000ff">&lt;/</span><span style="color: #800000">property</span><span style="color: #0000ff">&gt;</span></pre>
</p></div>
</div>
<p>Depending on your underlying databases and mappings this could cause problems with your code project.&#160; Hopefully you’re not using reserved words, or bad Oracle syntax =).</p>
<p>Under the hood, the problem seems to be that the Oracle10gDialect does not provide an implementation of IDataBaseSchema for 10gR1.&#160;&#160; Fabio Maulo has provided some sample code and the steps on <a title="Create missing IDataBaseSchema for submission to NHibernate" href="http://fabiomaulo.blogspot.com/2009/06/from-where-start-to-implements.html" rel="tag">how to create the appropriate metadata</a> for your database and submit it to the NHibernate project for inclusion. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/04/nhibernate-2-1-throws-system-invalidcastexception-on-oracle-10g-r1-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to NHibernate 2.1 for new Validators!</title>
		<link>http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/</link>
		<comments>http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 23:04:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[nHibernate]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/</guid>
		<description><![CDATA[I wanted to implemented the new NHibernate Validators which meant upgrading to NH 2.1.&#160;&#160; Found a great post documenting the new “breaking change” between 2.0 and 2.1 pertaining to the new proxy factory functionality in NH.&#160; “The ProxyFactoryFactory was not configured.” jumped up and bit me in the ass.&#160;&#160; NH used to assume Castle – [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to implemented the new <a title="NHibernate Validators" href="http://nhforge.org/wikis/validator/nhibernate-validator-1-0-0-documentation.aspx" rel="tag">NHibernate Validators</a> which meant upgrading to NH 2.1.&#160;&#160; Found a great post documenting the new “breaking change” between 2.0 and 2.1 pertaining to the new proxy factory functionality in NH.&#160; “The ProxyFactoryFactory was not configured.” jumped up and bit me in the ass.&#160;&#160; </p>
<p>NH used to assume Castle – but now it needs to be configured.&#160; In addition to the Castly proxy, there is a new LinFu proxy available too.&#160;&#160; <a title="Upgrading to NHibernate 2.1 - The ProxyFactoryFactory was not configured." href="http://davybrion.com/blog/2009/03/upgrading-to-nhibernate-21/" rel="tag">Don’t bother with NHibernate the release notes!</a> , Davy Brion has it all for you here =).&#160; </p>
<p>I opted to go with the Castly Dynamic Proxy – I’m not in a position to do any performance tests between– Castle has been around a long time and has a pretty big user base.&#160; Good <a title="Castly Dynamic Proxy vs LinFu" href="http://stackoverflow.com/questions/1406762/what-are-the-differences-between-linfu-dynamicproxy-and-castle-dynamicproxy" rel="tag">post on stackoverflow</a> on this subject.&#160; However, LinFu would have won if I was basing my choice on name alone…</p>
<p>After a bit of fiddling, I’m back up and running with NH 2.1 and shiny new validation attributes.&#160;&#160;&#160; </p>
<p>mmmm validation…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2010/03/upgrading-to-nhibernate-2-1-for-new-validators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RADE Milestone &#8211; Object Relational Mapping with NHibernate</title>
		<link>http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/</link>
		<comments>http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 09:37:00 +0000</pubDate>
		<dc:creator>Darrin Maidlow</dc:creator>
				<category><![CDATA[RADE]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[nHibernate]]></category>

		<guid isPermaLink="false">http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/</guid>
		<description><![CDATA[It&#8217;s 1:30AM, I guess it&#8217;s Saturday now. =)&#160; I&#8217;ve been furiously pounding away for the past two weeks building a new data access layer for RADE 4.0.&#160; Gotta love 12 &#8211; 18 hour days for two weeks (Good thing I love software development).&#160; My wife is away for the week, so I can continue working [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s 1:30AM, I guess it&#8217;s Saturday now. =)&#160; I&#8217;ve been furiously pounding away for the past two weeks building a new <a title="ORM data access layer" href="http://en.wikipedia.org/wiki/Data_access_layer" target="_blank" rel="tag">data access layer</a> for RADE 4.0.&#160; Gotta love 12 &#8211; 18 hour days for two weeks (Good thing I love software development).&#160; My wife is away for the week, so I can continue working these stupid hours for another week.&#160; Anyhow I&#8217;ve chosen to proceed with <a title="nHibernate ORM" href="http://www.nhibernate.com" target="_blank" rel="tag">NHibernate</a> for the time being.&#160; <a title="LINQ" href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx" target="_blank" rel="tag">LINQ</a> with the <a title="Entity Framework" href="http://blogs.msdn.com/adonet/archive/2007/04/28/ado-net-entity-framework-update.aspx" target="_blank" rel="tag">Entity Framework</a> looks really cool and I&#8217;ve used it for some small research/test projects recently, but with the lack of support for database other than SQL server &#8211; it&#8217;s not an option at this time.</p>
<p>NHibernate was a tough curve for me.&#160; Initially, I started testing code generators.&#160; After spending a significant amount of time reading, testing, and pulling out hair I came to the conclusion that <a title="nHibernate code generation is still lacking" href="http://www.ayende.com/Blog/archive/2007/03/17/On-the-sad-state-of-NHibernate-code-generation.aspx" target="_blank" rel="tag">NHibernate code generation is still not there</a>.&#160; From my experiences <a title="genwise nHibernate code generator" href="http://www.genwise.com" target="_blank" rel="tag">Genwise</a> is probably the best code generator out there right now &#8211; but its still lacking in some areas.&#160; More importantly however, I learned that code generation is not a good place to start when implementing NHibernate for the first time.&#160; There is so much going on under the hood &#8211; in my opinion you need to start off doing a reasonable size project by hand.&#160; Code generation has significant benefits, because the generated code is so similar with simple replacements it just makes a lot of sense once you wrap your head around what&#8217;s going on with NHibernate.</p>
<p>As per my <a title="ReSharper - painless class creation" href="http://www.geospecialling.com/index.php/2008/07/resharper-a-class-creating-machine/" target="_blank" rel="tag">previous post on ReSharper</a> when implementing nHibernate by hand, <a title="ReSharper" href="http://www.jetbrains.com/resharper/" target="_blank" rel="tag">ReSharper is a must have</a>.&#160; Just the other day I found a *great* ReSharper <a title="ReSharper NHibernate Plugin" href="http://nhplugin.lieser-online.de/" target="_blank" rel="tag">NHibernate Plugin</a>.&#160; When editing NHibernate HBM XML files, it does a bunch of validation right in the editor.&#160; Saves you a lot of time finding problems without having to actually run a unit test and debug sometimes cryptic error messages.</p>
<p>I bought a copy of <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F1932394923%3Fpf%5Frd%5Fm%3DATVPDKIKX0DER%26pf%5Frd%5Fs%3Dcenter-2%26pf%5Frd%5Fr%3D1MWGQH6SNCMY6AMCW734%26pf%5Frd%5Ft%3D101%26pf%5Frd%5Fp%3D278240301%26pf%5Frd%5Fi%3D507846&amp;tag=r0a0-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">NHibernate In Action</a><img style="margin: 0px; border-top-style: none! important; border-right-style: none! important; border-left-style: none! important; border-bottom-style: none! important" height="1" alt="" src="http://www.assoc-amazon.com/e/ir?t=r0a0-20&amp;l=ur2&amp;o=1" width="1" border="0" />.&#160; I would recommend this book to you only if you have no experience, or understanding of Object Relational Mappers.&#160; As the book stands right now, it&#8217;s not really a good developer reference and only covers really basic examples.&#160; The documents that helped me the most to get everything up and running was <a title="NHibernate FAQ" href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/03/31/prepare-your-system-for-nhibernate.aspx" target="_blank" rel="tag">The NHibernate FAQ</a>.&#160; The NHibernate documentation is pretty cryptic.&#160; Don&#8217;t read this stuff 12 hours into your day.&#160; No amount of RedBull will give you the focus needed to make sense of it.&#160; In the first 8 hours of the day, its quite helpful.</p>
<p>I primarily work in VB.NET.&#160; For this project however, I switched to C#.&#160; Maybe now, the my colleagues at <a title="bear mountain software" href="http://www.bearmountainsoftware.com" target="_blank" rel="tag">Bear Mountain</a> will stop giving me a hard time =).&#160; Seriously though.&#160; Examples are a LOT easier to come by in C#, probably 10:1. </p>
<p>Finally, get NUnit running.&#160; I had a lot of problems using the built in Microsoft Test projects with NHibernate &#8211; so I&#8217;ll be sticking with NUnit. If you&#8217;ve never done unit testing (you know who you are) do it.&#160; Particularly in this case &#8211; its crucial.&#160; You (Again you know who you are =]) used to write simple winform apps, and put a bunch of buttons on them.&#160; Don&#8217;t do that.&#160; </p>
<p>So, if you are one of the RADE non-developer users and you read on this far.&#160; Congrats.&#160; This milestone will not directly help you with your use of RADE.&#160; However, it&#8217;s a large step forward for the underlying architecture &#8211; and you will benefit from that.&#160; </p>
<p>Well back to Visual Studio I go..</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dc01ed48-a1bc-49eb-a8db-414dc5dc3243" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/.NET" rel="tag">.NET</a>,<a href="http://technorati.com/tags/NHibernate" rel="tag">NHibernate</a>,<a href="http://technorati.com/tags/RADE" rel="tag">RADE</a>,<a href="http://technorati.com/tags/Resharper" rel="tag">Resharper</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.geospecialling.com/index.php/2008/07/rade-milestone-object-relational-mapping-with-nhibernate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

