﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;set/&gt;</title><description>huey &amp; Noam,
  
outer-join is deprecated in Hibernate, IIRC, probably should be in NH as well.
  
  
huey,
  
regarding the where clause, since we can use this in a join, it is possible that the value (even if it is non nullable) be null, and we should take that into account.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment13</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment13</guid><pubDate>Tue, 21 Apr 2009 07:32:52 GMT</pubDate></item><item><title>Noam Gal commented on NHibernate Mapping - &lt;set/&gt;</title><description>I am also confused regarding the differences between 
  
"lazy=false, fetch=join" and "outer-join=true", like Huey wrote. Is there some major difference between the two options (apart from the count select into the formula there)?
  
I vaguely remember from Hibernate that one option was getting obselete. Is this the case here as well? Is one just here for backwards compatibility?
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment12</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment12</guid><pubDate>Thu, 16 Apr 2009 06:25:46 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;set/&gt;</title><description>Jan,
  
That is explicitly mentioned in the CreateQuery docs.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment11</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment11</guid><pubDate>Wed, 15 Apr 2009 10:48:53 GMT</pubDate></item><item><title>Jan Willem commented on NHibernate Mapping - &lt;set/&gt;</title><description>Thanks for the posts. 
  
  
It should be noted that the fetching strategy is ignored when using HQL. That is not obvious (at least for me it wasn't).
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment10</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment10</guid><pubDate>Wed, 15 Apr 2009 10:41:04 GMT</pubDate></item><item><title>Frank Quednau commented on NHibernate Mapping - &lt;set/&gt;</title><description>You rightfully note that joins generate a cartesian product. What it also does for me is creating an instance of "parent" for every "child" returned to it (which, however, each contain the correct "childs") . The inadequacies of cartesian products aside, is there any way to avoid this or would it be my job to reduce the list to those entities not equal to each other?
  
  
On a "minor" note: Combining fetch mode "subselect" with pagination (set maxresults, etc.) against an Oracle DB results in a broken SQL statement because some statement does not get its parameter that checks whether rownum stays below the max result value.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment9</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment9</guid><pubDate>Tue, 14 Apr 2009 14:57:37 GMT</pubDate></item><item><title>Frank Quednau commented on NHibernate Mapping - &lt;set/&gt;</title><description>@huey
  
In my current test, the statement being generated with lazy=false, fetch=join contains a left outer join. Such a join may produce DB Nulls for child items, in this example it will return Blogs with no Posts. here all Columns to Post will be filled with Null.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment8</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment8</guid><pubDate>Tue, 14 Apr 2009 14:47:34 GMT</pubDate></item><item><title>huey commented on NHibernate Mapping - &lt;set/&gt;</title><description>I'm a bit confused with outer-join and fetch.  I don't think I've ever used outer-join in my mappings but have done fetch=join.  Does it have to do with lazy?  Eg:
  
  
"lazy=false, fetch=join" == "outer-join=true" ?
  
  
Also:
  
  
"Note that there is important subtlety here, if you intend to use this collection with eager loading, you must make sure that your where clause can handle null values appropriately (in the case of an outer join)."
  
  
Not to be dense, but I'm not 100% sure I follow this :(
  
  
------
  
  
Is there an opinion on having multiple collections for the same relationship but with different where clauses versus using selection criteria in your repository?  Like if I have a customer with orders, and I have say 3 order 'sets' one for completed orders, one for unprocessed orders, and one for in process orders.  I hadn't really thought about using where clause and defining the one-to-many relationship three times, but it seems sort of cool.  I can just ask for the customer and then go over the sets without having to ask my repository to do anything.  Is this a bad idea, or pretty common and I'm just realizing it :)
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment7</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment7</guid><pubDate>Tue, 14 Apr 2009 12:22:13 GMT</pubDate></item><item><title>Steve commented on NHibernate Mapping - &lt;set/&gt;</title><description>ok gotcha
  
  
My scenario would be:  I have an average of 5-10 'posts' for each 'blog'.
  
  
I tend to always need to be doing something with posts  - so I decide I want to pull all the posts for each blog anytime I get a blog.
  
  
Currently I'm doing what I *think* you are suggesting - I'm using ICriteria and using a fetch join on posts.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment6</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment6</guid><pubDate>Mon, 13 Apr 2009 21:50:34 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;set/&gt;</title><description>Steve,
  
No way to tell without knowing more about your scenario.
  
If this is a parent - children scenario, probably you want to eager load the children.
  
I suggest doing this locally and not in the mapping, though.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment5</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment5</guid><pubDate>Mon, 13 Apr 2009 21:46:17 GMT</pubDate></item><item><title>Steve commented on NHibernate Mapping - &lt;set/&gt;</title><description>Let me try to understand this better, as I must admit, the options can be confusing  :)
  
  
I tend to have scenarios where I need to do as your example - get a parent and then loop through the child collections - ie. let's say you want to display a list of those posts in some sort of DataGrid.
  
  
Would subselect be the way to go then ?
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment4</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment4</guid><pubDate>Mon, 13 Apr 2009 21:43:32 GMT</pubDate></item><item><title>Toloma&amp;#252;s commented on NHibernate Mapping - &lt;set/&gt;</title><description>I agree on your subselect comment. This is my default fetch value for one-to-manies. 
  
I have noted however that even when setting lazy to false, the subselect is not immediately executed. Instead I have to do an initialize on one of the subcollections after loading the initial collection.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment3</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment3</guid><pubDate>Mon, 13 Apr 2009 21:01:30 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Mapping - &lt;set/&gt;</title><description>Tolomaüs,
  
Yes, thank you. Fixed.
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment2</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment2</guid><pubDate>Mon, 13 Apr 2009 20:54:34 GMT</pubDate></item><item><title>Toloma&amp;#252;s commented on NHibernate Mapping - &lt;set/&gt;</title><description>"
  
If we just set lazy to true, it means that when we load the entity, we load the collection. The reason that we see the same output from SQL perspective is that we don’t have a time perspective of that. With lazy set to false, the collection will only be loaded in the foreach. With lazy set to true, the collection will be loaded on the Get call.
  
"
  
  
Isn't it the other way around?
  
  
Otherwise an excellent read again so far!
</description><link>http://ayende.com/3943/nhibernate-mapping-set#comment1</link><guid>http://ayende.com/3943/nhibernate-mapping-set#comment1</guid><pubDate>Mon, 13 Apr 2009 20:50:32 GMT</pubDate></item></channel></rss>