<?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: LightSpeed Passes Mats&#8217; Challenge</title>
	<atom:link href="http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/</link>
	<description>The official blog of Mindscape</description>
	<lastBuildDate>Tue, 07 Feb 2012 19:49:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Andrew Peters</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-811</link>
		<dc:creator>Andrew Peters</dc:creator>
		<pubDate>Tue, 26 Jun 2007 12:07:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-811</guid>
		<description>&gt; And while it looked at a glance like using subselects could be easier, I discussed it a bit with
&gt; Roger Johansson and it quickly became apparent that it probably is much harder, yes.

Resulting in much premature baldness :-)

We are currently in beta and will be releasing in the next couple of weeks. For now you could link to: http://www.mindscape.co.nz/blog/?p=23 and we also have an EAP site: http://eap.mindscape.net.nz/

Cheers,

Andrew.</description>
		<content:encoded><![CDATA[<p>> And while it looked at a glance like using subselects could be easier, I discussed it a bit with<br />
> Roger Johansson and it quickly became apparent that it probably is much harder, yes.</p>
<p>Resulting in much premature baldness :-)</p>
<p>We are currently in beta and will be releasing in the next couple of weeks. For now you could link to: <a href="http://www.mindscape.co.nz/blog/?p=23" rel="nofollow">http://www.mindscape.co.nz/blog/?p=23</a> and we also have an EAP site: <a href="http://eap.mindscape.net.nz/" rel="nofollow">http://eap.mindscape.net.nz/</a></p>
<p>Cheers,</p>
<p>Andrew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mats Helander</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-810</link>
		<dc:creator>Mats Helander</dc:creator>
		<pubDate>Tue, 26 Jun 2007 11:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-810</guid>
		<description>Oh, and does LightSpeed have a product page, so I can add a link to it in the post about your triumphant victory? :-)

/Mats</description>
		<content:encoded><![CDATA[<p>Oh, and does LightSpeed have a product page, so I can add a link to it in the post about your triumphant victory? :-)</p>
<p>/Mats</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mats Helander</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-809</link>
		<dc:creator>Mats Helander</dc:creator>
		<pubDate>Tue, 26 Jun 2007 11:48:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-809</guid>
		<description>Andrew,

Interesting!

And while it looked at a glance like using subselects could be easier, I discussed it a bit with Roger Johansson and it quickly became apparent that it probably is much harder, yes.

/Mats</description>
		<content:encoded><![CDATA[<p>Andrew,</p>
<p>Interesting!</p>
<p>And while it looked at a glance like using subselects could be easier, I discussed it a bit with Roger Johansson and it quickly became apparent that it probably is much harder, yes.</p>
<p>/Mats</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Peters</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-808</link>
		<dc:creator>Andrew Peters</dc:creator>
		<pubDate>Tue, 26 Jun 2007 11:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-808</guid>
		<description>Mats,

Good question! The reason for the subselect is because it better represents my intent: Give me *only* OrderLines that have Orders from a Customer whose Id &gt; 0. 

See: http://andrewpeters.net/2006/09/28/quote-of-the-day-from-oracles-ask-tom/ for a bit more info.

As discussed in that post, I&#039;m relying on the DB optimizer to figure things out. If it turns out that a join based strategy is consistently faster then I will need to review the implementation. With respect to it requiring less-transformation, an early iteration of the query builder used a join strategy and I seem to recall it was easier to implement.

Cheers,

Andrew.</description>
		<content:encoded><![CDATA[<p>Mats,</p>
<p>Good question! The reason for the subselect is because it better represents my intent: Give me *only* OrderLines that have Orders from a Customer whose Id > 0. </p>
<p>See: <a href="http://andrewpeters.net/2006/09/28/quote-of-the-day-from-oracles-ask-tom/" rel="nofollow">http://andrewpeters.net/2006/09/28/quote-of-the-day-from-oracles-ask-tom/</a> for a bit more info.</p>
<p>As discussed in that post, I&#8217;m relying on the DB optimizer to figure things out. If it turns out that a join based strategy is consistently faster then I will need to review the implementation. With respect to it requiring less-transformation, an early iteration of the query builder used a join strategy and I seem to recall it was easier to implement.</p>
<p>Cheers,</p>
<p>Andrew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mats Helander</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-807</link>
		<dc:creator>Mats Helander</dc:creator>
		<pubDate>Tue, 26 Jun 2007 11:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-807</guid>
		<description>Hi Andrew,

&quot;Named aggregates are not essential for this&quot;,

The part that would be essential (I think) is to be able to tell the mapper when it will be alright to resolve both sides of the relationships it touches when filling the objects. I think that stating &quot;My query is againist a named aggregate&quot; in the query, and letting the mapper provide the secondary sql statements from that information, provides exactly the information I was looking for.

In your new sql example to Kirk,

Why do you use a subselect in the third statement instead of just a join (in the where clause! we&#039;re not talking about joining in tables into the result, getting Cartesian products)? Is it because it requires less transformation (you can basically just wrap the original query up into the subquery) ?

/Mats</description>
		<content:encoded><![CDATA[<p>Hi Andrew,</p>
<p>&#8220;Named aggregates are not essential for this&#8221;,</p>
<p>The part that would be essential (I think) is to be able to tell the mapper when it will be alright to resolve both sides of the relationships it touches when filling the objects. I think that stating &#8220;My query is againist a named aggregate&#8221; in the query, and letting the mapper provide the secondary sql statements from that information, provides exactly the information I was looking for.</p>
<p>In your new sql example to Kirk,</p>
<p>Why do you use a subselect in the third statement instead of just a join (in the where clause! we&#8217;re not talking about joining in tables into the result, getting Cartesian products)? Is it because it requires less transformation (you can basically just wrap the original query up into the subquery) ?</p>
<p>/Mats</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mats Helander Weblog &#187; Blog Archive &#187; LightSpeed from MindScape Passes The O/R Mapping Challenge</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-806</link>
		<dc:creator>Mats Helander Weblog &#187; Blog Archive &#187; LightSpeed from MindScape Passes The O/R Mapping Challenge</dc:creator>
		<pubDate>Tue, 26 Jun 2007 10:57:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-806</guid>
		<description>[...] Peters from MindScape just posted that their mapper LightSpeed passes the challenge. At first I thought he must have misread the [...]</description>
		<content:encoded><![CDATA[<p>[...] Peters from MindScape just posted that their mapper LightSpeed passes the challenge. At first I thought he must have misread the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Peters</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-805</link>
		<dc:creator>Andrew Peters</dc:creator>
		<pubDate>Tue, 26 Jun 2007 10:54:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-805</guid>
		<description>Kirk,

Good spotting. If no criteria have been set and we are eagerly following a dependent association (fk not null), then we can omit the filtering normally required to return the right set of child objects.

So, for the more common case:
&lt;pre lang=&quot;csharp&quot;&gt;
// contrived example:

Repository.Find&lt;Customer&gt;(Entity.Attribute(&quot;Id&quot;) &gt; 0)
&lt;/pre&gt;
We end up with:
&lt;pre lang=&quot;sql&quot;&gt;
SELECT
  Customers.Id,
  Customers.CustomerName
FROM
  Customers
WHERE
  Customers.Id &gt; 0;

SELECT
  Orders.Id,
  Orders.IsShipped,
  Orders.CustomerId
FROM
  Orders
WHERE
  Orders.CustomerId &gt; 0;

SELECT
  OrderLines.Id,
  OrderLines.Total,
  OrderLines.OrderId
FROM
  OrderLines
WHERE
  EXISTS (
    SELECT
      Orders.*
    FROM
      Orders
    WHERE
      Orders.Id = OrderLines.OrderId AND
      EXISTS (
        SELECT
          Customers.*
        FROM
          Customers
        WHERE
          Customers.Id = Orders.CustomerId AND
          Customers.Id &gt; 0
      )
  )
&lt;/pre&gt;
Still single batch, 3 selects however.

Cheers,

Andrew.</description>
		<content:encoded><![CDATA[<p>Kirk,</p>
<p>Good spotting. If no criteria have been set and we are eagerly following a dependent association (fk not null), then we can omit the filtering normally required to return the right set of child objects.</p>
<p>So, for the more common case:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// contrived example:</span>
&nbsp;
Repository<span style="color: #008000;">.</span><span style="color: #0000FF;">Find</span><span style="color: #008000;">&lt;</span>Customer<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>Entity<span style="color: #008000;">.</span><span style="color: #0000FF;">Attribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Id&quot;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span></pre></div></div>

<p>We end up with:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>
  Customers<span style="color: #66cc66;">.</span>Id<span style="color: #66cc66;">,</span>
  Customers<span style="color: #66cc66;">.</span>CustomerName
<span style="color: #993333; font-weight: bold;">FROM</span>
  Customers
<span style="color: #993333; font-weight: bold;">WHERE</span>
  Customers<span style="color: #66cc66;">.</span>Id <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span>
  Orders<span style="color: #66cc66;">.</span>Id<span style="color: #66cc66;">,</span>
  Orders<span style="color: #66cc66;">.</span>IsShipped<span style="color: #66cc66;">,</span>
  Orders<span style="color: #66cc66;">.</span>CustomerId
<span style="color: #993333; font-weight: bold;">FROM</span>
  Orders
<span style="color: #993333; font-weight: bold;">WHERE</span>
  Orders<span style="color: #66cc66;">.</span>CustomerId <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span>
  OrderLines<span style="color: #66cc66;">.</span>Id<span style="color: #66cc66;">,</span>
  OrderLines<span style="color: #66cc66;">.</span>Total<span style="color: #66cc66;">,</span>
  OrderLines<span style="color: #66cc66;">.</span>OrderId
<span style="color: #993333; font-weight: bold;">FROM</span>
  OrderLines
<span style="color: #993333; font-weight: bold;">WHERE</span>
  <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #66cc66;">&#40;</span>
    <span style="color: #993333; font-weight: bold;">SELECT</span>
      Orders<span style="color: #66cc66;">.*</span>
    <span style="color: #993333; font-weight: bold;">FROM</span>
      Orders
    <span style="color: #993333; font-weight: bold;">WHERE</span>
      Orders<span style="color: #66cc66;">.</span>Id <span style="color: #66cc66;">=</span> OrderLines<span style="color: #66cc66;">.</span>OrderId <span style="color: #993333; font-weight: bold;">AND</span>
      <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #66cc66;">&#40;</span>
        <span style="color: #993333; font-weight: bold;">SELECT</span>
          Customers<span style="color: #66cc66;">.*</span>
        <span style="color: #993333; font-weight: bold;">FROM</span>
          Customers
        <span style="color: #993333; font-weight: bold;">WHERE</span>
          Customers<span style="color: #66cc66;">.</span>Id <span style="color: #66cc66;">=</span> Orders<span style="color: #66cc66;">.</span>CustomerId <span style="color: #993333; font-weight: bold;">AND</span>
          Customers<span style="color: #66cc66;">.</span>Id <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span>
      <span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Still single batch, 3 selects however.</p>
<p>Cheers,</p>
<p>Andrew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Peters</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-804</link>
		<dc:creator>Andrew Peters</dc:creator>
		<pubDate>Tue, 26 Jun 2007 10:44:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-804</guid>
		<description>Hi Mats,

Thanks!

Named aggregates are not essential for this just the EagerLoad attribute. Named aggregates simply allow for varying eager/lazy behavior at the association level per use case.

Cheers,

Andrew.</description>
		<content:encoded><![CDATA[<p>Hi Mats,</p>
<p>Thanks!</p>
<p>Named aggregates are not essential for this just the EagerLoad attribute. Named aggregates simply allow for varying eager/lazy behavior at the association level per use case.</p>
<p>Cheers,</p>
<p>Andrew.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mats Helander</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-803</link>
		<dc:creator>Mats Helander</dc:creator>
		<pubDate>Tue, 26 Jun 2007 10:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-803</guid>
		<description>Amazing! Now I understand! :-) (I followed the &quot;Eager&quot; link)

The information that I wanted to put in a new type of DSL in my posts about Eager Loading &quot;Hints&quot; is neatly contained in your named aggregates! Completely brilliant and /exactly/ the type of good thinking about the problem that I was looking for!

So, you indeed pass the challenge, and your answer to the problem behind the challenge is named aggregates. My hat is well and truely off!

/Mats</description>
		<content:encoded><![CDATA[<p>Amazing! Now I understand! :-) (I followed the &#8220;Eager&#8221; link)</p>
<p>The information that I wanted to put in a new type of DSL in my posts about Eager Loading &#8220;Hints&#8221; is neatly contained in your named aggregates! Completely brilliant and /exactly/ the type of good thinking about the problem that I was looking for!</p>
<p>So, you indeed pass the challenge, and your answer to the problem behind the challenge is named aggregates. My hat is well and truely off!</p>
<p>/Mats</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kirk Jackson</title>
		<link>http://www.mindscapehq.com/blog/index.php/2007/06/26/lightspeed-passes-mats-challenge/comment-page-1/#comment-802</link>
		<dc:creator>Kirk Jackson</dc:creator>
		<pubDate>Tue, 26 Jun 2007 10:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.mindscape.co.nz/blog/?p=35#comment-802</guid>
		<description>Hi Andrew, 

Does that mean that you&#039;ve specifically coded for the unfiltered case -- where if the root collection is filled with a &quot;select *&quot;, you determine that the eager fetching is also a &quot;select *&quot; based upon the relationship type?

Not often that want to load a whole tree of the database into memory, but when I do, I guess it pays to be as efficient as possible.

Cool.

Kirk</description>
		<content:encoded><![CDATA[<p>Hi Andrew, </p>
<p>Does that mean that you&#8217;ve specifically coded for the unfiltered case &#8212; where if the root collection is filled with a &#8220;select *&#8221;, you determine that the eager fetching is also a &#8220;select *&#8221; based upon the relationship type?</p>
<p>Not often that want to load a whole tree of the database into memory, but when I do, I guess it pays to be as efficient as possible.</p>
<p>Cool.</p>
<p>Kirk</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic (Requested URI is rejected)
Database Caching 3/19 queries in 0.014 seconds using disk: basic
Content Delivery Network via cdn.mindscapehq.com

Served from: www.mindscapehq.com @ 2012-02-08 02:33:52 -->
