<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Query with different order by</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Query with different order by</description>
  <pubDate>Mon, 13 Apr 2026 08:08:19 -700</pubDate>
  <lastBuildDate>Fri, 18 Feb 2011 14:57:20 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=2516</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Query with different order by : Hi Jignesh,  To answer your...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9991#9991</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2516<br /><strong>Posted:</strong> 18-Feb-2011 at 2:57pm<br /><br />Hi Jignesh,<DIV>&nbsp;</DIV><DIV>To answer your question: no, it's not true.</DIV><DIV>&nbsp;</DIV><DIV>Note that <EM>query cache</EM> and <EM>entity cache </EM>are not the same thing and by simply saying "cache" I'd assume you are referring to the <EM>entity cache</EM>. So maybe the answer to your question should be:&nbsp;it depends on what you mean by "cache" when you mentioned "<EM>it should check <U>cache</U> first and then hit the database". </EM></DIV><DIV>&nbsp;</DIV><DIV>To make your sentence sound correct: "it should check <U>the query cache</U> first and then hit the database".</DIV><DIV>&nbsp;</DIV><DIV>Back to the Querystrategy: QueryStrategy.Normal has an Optimized FetchStrategy. <EM>FetchStrategy.Optimized </EM>checks the <EM>query cache</EM> to see if the current query has previously been submitted successfully. If so, it satisfies the query from the <EM>entity cache</EM>, and skip the trip to the datasource. Otherwise, a trip to the datasource is necessary.</DIV><DIV>&nbsp;</DIV><DIV>You can also find more information about Query Strategies in our <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/Query-Strategy" target="_blank">DevForce Resource Center</A>.</DIV><DIV>&nbsp;</DIV><DIV>Silvio.</DIV>]]>
   </description>
   <pubDate>Fri, 18 Feb 2011 14:57:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9991#9991</guid>
  </item> 
  <item>
   <title>Query with different order by : I am usingQueryStrategy asQueryStrategy.Normal....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9990#9990</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=957" rel="nofollow">hijaggu</a><br /><strong>Subject:</strong> 2516<br /><strong>Posted:</strong> 18-Feb-2011 at 1:55pm<br /><br />I am using&nbsp;<span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">QueryStrategy as&nbsp;<span apple-style-span="Apple-style-span" style="font-family: c&#111;nsolas; white-space: pre; "><span style="color: rgb43, 145, 175; ">QueryStrategy</span>.Normal. So it should check cache first and then hit the database. is that true ?  </span></span><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><span apple-style-span="Apple-style-span" style="font-family: c&#111;nsolas; white-space: pre; "><br></span></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><span apple-style-span="Apple-style-span" style="font-family: c&#111;nsolas; white-space: pre; ">- Jignesh </span></span></div>]]>
   </description>
   <pubDate>Fri, 18 Feb 2011 13:55:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9990#9990</guid>
  </item> 
  <item>
   <title>Query with different order by : Hi Jignesh,   Each query above...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9989#9989</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2516<br /><strong>Posted:</strong> 18-Feb-2011 at 1:52pm<br /><br />Hi Jignesh, <DIV>&nbsp;</DIV><DIV>Each query above will be executed against the data source because the EntityManager checks for the exact same query in the&nbsp;QueryCache. Although similar, the 3 queries are not identical.</DIV><DIV>&nbsp;</DIV><DIV>Ideally, if you know the data you will work with is in cache, your explicitly set QueryStrategy to CacheOnly.</DIV><DIV>&nbsp;</DIV><DIV>You can find more information on the QueryCache in our <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/Entity-Cache#HQueryCache" target="_blank">DevForce Resource Center</A>.</DIV><DIV>&nbsp;</DIV><DIV>Silvio.</DIV>]]>
   </description>
   <pubDate>Fri, 18 Feb 2011 13:52:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9989#9989</guid>
  </item> 
  <item>
   <title>Query with different order by : Hi ,	I would like to understand...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9986#9986</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=957" rel="nofollow">hijaggu</a><br /><strong>Subject:</strong> 2516<br /><strong>Posted:</strong> 18-Feb-2011 at 10:47am<br /><br />Hi ,<div><br></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>I would like to understand how IdeaBlade caching works if we apply different order by criterion on same query.&nbsp;</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>As per my understanding , once Ideablade retrieves any entities, it keeps them in cache and going forward if we query for the same entities again it uses cache instead of hitting the database again if QueryStrategy is&nbsp;<span ="Apple-style-span" style="font-family: c&#111;nsolas; white-space: pre; "><span style="color: #2b91af">QueryStrategy</span>.Normal.<br></span>&nbsp;</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>Would u plz. let me know what will be behavior of&nbsp;IdeaBlade&nbsp;if we fire below queries in given order ?&nbsp;</div><div><br></div><div><pre style="font-family: c&#111;nsolas"><span style="color: #2b91af"> 1.  MyEntityManager</span>.Instance.Zips.Where&lt;<span style="color: #2b91af">Zip</span>&gt;&nbsp;(&nbsp;p&nbsp;=&gt;&nbsp;p.State.StartsWith&nbsp;(&nbsp;<span style="color: #a31515">"CA"</span>&nbsp;)&nbsp;)  --- &gt; Load the data from database<br><br></pre><pre style="font-family: c&#111;nsolas">&nbsp;2.  <span ="Apple-style-span" style="color: rgb43, 145, 175; ">MyEntityManager</span>.Instance.Zips.Where&lt;<span style="color: #2b91af">Zip</span>&gt;(p&nbsp;=&gt;&nbsp;p.State.StartsWith(<span style="color: #a31515">"CA"</span>))&nbsp;-- &gt; Load the data from database or use Cache ???<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.OrderBy(p&nbsp;=&gt;&nbsp;p.City&nbsp;&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ThenBy&nbsp;(&nbsp;p&nbsp;=&gt;&nbsp;p.Code&nbsp;);<br> <br> 3.  <span ="Apple-style-span" style="color: rgb43, 145, 175; ">MyEntityManager</span>.Instance.Zips.Where&lt;<span style="color: #2b91af">Zip</span>&gt;&nbsp;(&nbsp;p&nbsp;=&gt;&nbsp;p.State.StartsWith&nbsp;(&nbsp;<span style="color: #a31515">"CA"</span>&nbsp;)&nbsp;) -- &gt; Load the data from database or use Cache ???<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.OrderBy&nbsp;(&nbsp;p&nbsp;=&gt;&nbsp;p.Code&nbsp;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ThenBy&nbsp;(&nbsp;p&nbsp;=&gt;&nbsp;p.City&nbsp;);</pre><pre style="font-family: c&#111;nsolas"><br></pre><pre style="font-family: c&#111;nsolas">After executing first query above , we have all zip entities for CA state in cache. What would happen if we execute</pre><pre style="font-family: c&#111;nsolas">query 2 and 3 above ? Will it hit the database or sort the data already in cache and return the results ? </pre><pre style="font-family: c&#111;nsolas"><br></pre><pre style="font-family: c&#111;nsolas">- Jignesh Suthar </pre><pre style="font-family: c&#111;nsolas">  </pre><pre style="font-family: c&#111;nsolas"><br></pre></div>]]>
   </description>
   <pubDate>Fri, 18 Feb 2011 10:47:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2516&amp;PID=9986#9986</guid>
  </item> 
 </channel>
</rss>