<?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>students@work &#187; active record</title>
	<atom:link href="http://www.stupent.at/tag/active-record/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stupent.at</link>
	<description>Antworten auf die die Menschheit gewartet hat!  -- Heisenberg war hier ... oder auch nicht!</description>
	<lastBuildDate>Tue, 17 Aug 2010 13:51:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NHibernate/Active Record &#8211; StaleStateException?</title>
		<link>http://www.stupent.at/2010/01/12/nhibernateactive-record-stalestateexception/</link>
		<comments>http://www.stupent.at/2010/01/12/nhibernateactive-record-stalestateexception/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 13:15:50 +0000</pubDate>
		<dc:creator>Cici</dc:creator>
				<category><![CDATA[Absurdes]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[active record]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[nhibernate]]></category>

		<guid isPermaLink="false">http://www.stupent.at/?p=240</guid>
		<description><![CDATA[Today I had to use an Ative Record implementation for C#: Castle Active Record. It worked verfy fine until i needed to save a one to many relationship. Then the underlying NHibernate yielded the following Exception:
   StaleStateException: unexpected row count -1 expected 1 . 
Googling for that Exception gave me two options: At [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stupent.at%2F2010%2F01%2F12%2Fnhibernateactive-record-stalestateexception%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stupent.at%2F2010%2F01%2F12%2Fnhibernateactive-record-stalestateexception%2F" height="61" width="51" /></a></div><p>Today I had to use an Ative Record implementation for C#: <a href="http://www.castleproject.org/activerecord/index.html">Castle Active Record</a>. It worked verfy fine until i needed to save a one to many relationship. Then the underlying NHibernate yielded the following Exception:<br />
  <quote> StaleStateException: unexpected row count -1 expected 1 </quote>. </p>
<p>Googling for that Exception gave me two options: At first, turning the sql servers NOCOUNT property OFF by either sending &#8220;SET NOCOUNT OFF&#8221; or setting the appropriate property of the SQL-Server in the config dialog. Both did not work for me, as i am neither the Admin of the server nor i can send the command by hand through the many layers introduced by ActiveRecord/NHibernate. </p>
<p>Another possible solution was overriding the connection driver to let i send the query everytime the connection gets requested. This was proposed by the blog author of: http://www.socialanimal.com/archives/2008/03/07/nhibernate-and-nocount/. This either didn&#8217;t work for me.</p>
<p>But taking a look in the database suprised me! My Data was actually written! So a simply try {} catch(&#8230;) { //ignore } did the job! </p>
<p>SHAME ON ME FOR THAT <img src='http://www.stupent.at/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.stupent.at/2010/01/12/nhibernateactive-record-stalestateexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
