<?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: I think you mean a many-to-one sir</title>
	<atom:link href="http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/feed/" rel="self" type="application/rss+xml" />
	<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/</link>
	<description>Monkeying with the code</description>
	<lastBuildDate>Tue, 29 Jun 2010 13:30:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-52511</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Tue, 22 Jun 2010 10:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-52511</guid>
		<description>Frans: Always with the logic, eh? Thanks for the comments.

The main point I was trying to get across with this post is that for 90% of the time, people genuinely do want a m:1 relationship. I have no doubt that there are situations where 1:1 are useful, but I think beginners struggle to tell the difference (primarily because 1:1 is such a vapid and overloaded term in the db space).

As for the o/r side of it, yeah, no disagreement here.</description>
		<content:encoded><![CDATA[<p>Frans: Always with the logic, eh? Thanks for the comments.</p>
<p>The main point I was trying to get across with this post is that for 90% of the time, people genuinely do want a m:1 relationship. I have no doubt that there are situations where 1:1 are useful, but I think beginners struggle to tell the difference (primarily because 1:1 is such a vapid and overloaded term in the db space).</p>
<p>As for the o/r side of it, yeah, no disagreement here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frans Bouma</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-52425</link>
		<dc:creator>Frans Bouma</dc:creator>
		<pubDate>Fri, 11 Jun 2010 11:15:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-52425</guid>
		<description>On the FK side, when you have an fk + uc and the fk fields are constrained by the UC, and are non-nullable, pointing to a pk, this too is a 1:1 relationship. NHibernate ignores this as if it doesn&#039;t exist but that&#039;s not correct. This puts people off, as the m:1 they have to map with a &#039;unique&#039; attribute is really silly, it&#039;s not a m:1, it&#039;s a 1:1. 

For o/r mappers internally, the 1:1 relationship is a cumbersome thing: you have to keep track which side is the fk side, and you have to check whether the fk side is constrained by a UC or a PK constraint. But that doesn&#039;t mean it only exists in the pk-pk form, as the fk/uc-pk 1:1 is a true 1:1 relationship as well.</description>
		<content:encoded><![CDATA[<p>On the FK side, when you have an fk + uc and the fk fields are constrained by the UC, and are non-nullable, pointing to a pk, this too is a 1:1 relationship. NHibernate ignores this as if it doesn&#8217;t exist but that&#8217;s not correct. This puts people off, as the m:1 they have to map with a &#8216;unique&#8217; attribute is really silly, it&#8217;s not a m:1, it&#8217;s a 1:1. </p>
<p>For o/r mappers internally, the 1:1 relationship is a cumbersome thing: you have to keep track which side is the fk side, and you have to check whether the fk side is constrained by a UC or a PK constraint. But that doesn&#8217;t mean it only exists in the pk-pk form, as the fk/uc-pk 1:1 is a true 1:1 relationship as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-51769</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Sat, 24 Apr 2010 13:56:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-51769</guid>
		<description>This isn&#039;t really anything to do with HasMany. It&#039;s for many-to-one and one-to-one relationships, which are (in Fluent NHibernate) References and HasOne respectively.</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t really anything to do with HasMany. It&#8217;s for many-to-one and one-to-one relationships, which are (in Fluent NHibernate) References and HasOne respectively.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Cole</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-51755</link>
		<dc:creator>Mike Cole</dc:creator>
		<pubDate>Fri, 23 Apr 2010 14:43:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-51755</guid>
		<description>How is this mapped?  HasMany mapping requires a collection, not a single object.</description>
		<content:encoded><![CDATA[<p>How is this mapped?  HasMany mapping requires a collection, not a single object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Where&#8217;s Lou &#187; Blog Archive &#187; Extending NHibernate data with one-to-optional relationships</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-48641</link>
		<dc:creator>Where&#8217;s Lou &#187; Blog Archive &#187; Extending NHibernate data with one-to-optional relationships</dc:creator>
		<pubDate>Mon, 04 Jan 2010 01:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-48641</guid>
		<description>[...] It&#8217;s been said that ninety percent of the time you think there is a one-to-one relationship in NHibernate it&#8217;s really a many-to-one. I&#8217;ll agree with that. But this post is about one of the ten-percent cases when a single entity spans several table schemas. [...]</description>
		<content:encoded><![CDATA[<p>[...] It&#8217;s been said that ninety percent of the time you think there is a one-to-one relationship in NHibernate it&#8217;s really a many-to-one. I&#8217;ll agree with that. But this post is about one of the ten-percent cases when a single entity spans several table schemas. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: almasmith</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-45023</link>
		<dc:creator>almasmith</dc:creator>
		<pubDate>Wed, 02 Dec 2009 22:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-45023</guid>
		<description>Indeed, a foreign key to customer in the address table would create a one to many relationship (one customer can have many addresses).

The reason that one to one relationships are rare is due to the fact that they generally result in both pieces of information being stored in the same table (i.e. if a contact can only have one phone number then you just have a phone number column in the contact table).

James correctly demonstrated the one to one relationship having 2 tables that both share the same id.</description>
		<content:encoded><![CDATA[<p>Indeed, a foreign key to customer in the address table would create a one to many relationship (one customer can have many addresses).</p>
<p>The reason that one to one relationships are rare is due to the fact that they generally result in both pieces of information being stored in the same table (i.e. if a contact can only have one phone number then you just have a phone number column in the contact table).</p>
<p>James correctly demonstrated the one to one relationship having 2 tables that both share the same id.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Florian Fanderl</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-16750</link>
		<dc:creator>Florian Fanderl</dc:creator>
		<pubDate>Sun, 08 Mar 2009 11:43:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-16750</guid>
		<description>Thank you very much for that nice explanation.</description>
		<content:encoded><![CDATA[<p>Thank you very much for that nice explanation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tobin Harris</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-15447</link>
		<dc:creator>Tobin Harris</dc:creator>
		<pubDate>Tue, 27 Jan 2009 17:50:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-15447</guid>
		<description>Yeah, I rarely see anyone make a single column both a primary *and* a foreign key. 

I like the fact you get constraint checking for free: You can&#039;t add an address if there&#039;s no  corresponding customer, and you can&#039;t delete the customer without first deleting the address.</description>
		<content:encoded><![CDATA[<p>Yeah, I rarely see anyone make a single column both a primary *and* a foreign key. </p>
<p>I like the fact you get constraint checking for free: You can&#8217;t add an address if there&#8217;s no  corresponding customer, and you can&#8217;t delete the customer without first deleting the address.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-15444</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Tue, 27 Jan 2009 17:05:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-15444</guid>
		<description>Tobin: You could do that, but I&#039;ve never seen it done when intended to be a one-to-one; as a one-to-many yes, but not a one-to-one.</description>
		<content:encoded><![CDATA[<p>Tobin: You could do that, but I&#8217;ve never seen it done when intended to be a one-to-one; as a one-to-many yes, but not a one-to-one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tobin Harris</title>
		<link>http://jagregory.com/writings/i-think-you-mean-a-many-to-one-sir/comment-page-1/#comment-15440</link>
		<dc:creator>Tobin Harris</dc:creator>
		<pubDate>Tue, 27 Jan 2009 15:43:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=238#comment-15440</guid>
		<description>Nice post. You *might* be missing a foreign key constraint there. 

    table Customer (  
      Id int primary key,  
      Name varchar(100)
    )  

    table Address (  
      Id int primary key,  
      Number int,  
      Street varchar(100),
      foreign key customer_id (Id) references Customer(Id)  
    ) 

So, the address pk is also a fk to customer, enforcing that you can&#039;t have an address without a valid customer id.</description>
		<content:encoded><![CDATA[<p>Nice post. You *might* be missing a foreign key constraint there. </p>
<p>    table Customer (<br />
      Id int primary key,<br />
      Name varchar(100)<br />
    )  </p>
<p>    table Address (<br />
      Id int primary key,<br />
      Number int,<br />
      Street varchar(100),<br />
      foreign key customer_id (Id) references Customer(Id)<br />
    ) </p>
<p>So, the address pk is also a fk to customer, enforcing that you can&#8217;t have an address without a valid customer id.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
