﻿<?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>JasonA commented on NHibernate for SQL</title><description>Exactly what I was looking for. Thanks Ayende!
  
  
I needed to modify one of my HQL strings to use a case expression. 
  
I was disappointed to see that these weren't going to be supported in NHibernate 1.2.
  
  
Still being new to NHibernate and ActiveRecord, I wasn't sure if I could get to use my projection class under Native SQL. 
  
  
After applying your solution, I was *almost* off and running. 
  
One thing that caused me immediate problem was one of my projection class' properties was an entity. 
  
My quick fix was to add another property to the projection that did a FindByProperty.
  
  
The analogy to the Customers example would be to have a Customer entity property on the CustomerOrderTypesCount class, instead of a CustomerName.
  
  
</description><link>http://ayende.com/2706/nhibernate-for-sql#comment4</link><guid>http://ayende.com/2706/nhibernate-for-sql#comment4</guid><pubDate>Mon, 24 Sep 2007 22:00:16 GMT</pubDate></item><item><title>Aaron Ponzani commented on NHibernate for SQL</title><description>Many thanks!  This works like a charm for populating flat objects that need to query across multiple tables but are difficult for NHibernate to map or else not worth the overhead
</description><link>http://ayende.com/2706/nhibernate-for-sql#comment3</link><guid>http://ayende.com/2706/nhibernate-for-sql#comment3</guid><pubDate>Wed, 22 Aug 2007 20:06:05 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate for SQL</title><description>Hm, yes, that one is a typo.
</description><link>http://ayende.com/2706/nhibernate-for-sql#comment2</link><guid>http://ayende.com/2706/nhibernate-for-sql#comment2</guid><pubDate>Mon, 13 Aug 2007 09:31:08 GMT</pubDate></item><item><title>Renaud Martinon commented on NHibernate for SQL</title><description>If I understand your purpose correctly, shouldn't this be
  
&lt;&lt;
  
count( case order.Type when 1 then 1 else 0 end )  as FastOrder,
  
           count( case order.Type when 2 then 1 else 0 end )  as SlowOrder,
  
           count( case order.Type when 3 then 1 else 0 end )  as AirMailOrder
  
&gt;&gt;
  
?
  
  
If not, I could use some more explanations about what this code does.
  
</description><link>http://ayende.com/2706/nhibernate-for-sql#comment1</link><guid>http://ayende.com/2706/nhibernate-for-sql#comment1</guid><pubDate>Mon, 13 Aug 2007 09:06:50 GMT</pubDate></item></channel></rss>