﻿<?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>Gian Maria commented on NHibernate Worst Practice - SQL</title><description>The right way to proceed in my opion is: try to express the query in HQL or CRiteria, then if you cannot find a way to express your query in this way, try to see around the web if someone already solved a similar problem. Then if still you do not come to a solution try to ask on the forum, and if you still does not have a solution, maybe you really need SQL.
  
  
Quite often people are skilled with SQL and less with HQL, so they take another way, they do not have idea how to express the query in HQL, but they knows well how to create SQL query, so they simply resort to relay on the language they knows better (SQL), instead of using HQL 
  
  
alk.
  
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment8</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment8</guid><pubDate>Fri, 08 Aug 2008 09:50:41 GMT</pubDate></item><item><title>Tyler B commented on NHibernate Worst Practice - SQL</title><description>Oops, I mean ON constraints.
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment7</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment7</guid><pubDate>Thu, 07 Aug 2008 19:40:53 GMT</pubDate></item><item><title>Tyler B commented on NHibernate Worst Practice - SQL</title><description>Bunter said it exactly right.  We've needed to create custom stored procedures MANY times because of our legacy database.  And sometimes you just need additional WITH constraint in your joins (last I checked NHibernate didn't support this).
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment6</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment6</guid><pubDate>Thu, 07 Aug 2008 19:39:55 GMT</pubDate></item><item><title>Matthew J commented on NHibernate Worst Practice - SQL</title><description>If you have to use native sql, wouldn't it be easier to create and map a stored procedure to an object instead of embedding native sql into your app?
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment5</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment5</guid><pubDate>Thu, 07 Aug 2008 17:36:11 GMT</pubDate></item><item><title>Bunter commented on NHibernate Worst Practice - SQL</title><description>Sometimes it is the mappin and the db model making you go down that ugly route.
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment4</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment4</guid><pubDate>Thu, 07 Aug 2008 07:43:33 GMT</pubDate></item><item><title>Torkel commented on NHibernate Worst Practice - SQL</title><description>HQL and the Criteria API are very powerfull and they handle most scenarios, but I hit a problem recently. I wanted to join to a subquery (subquery that contained a projection and a group by). 
  
  
This did not appear to be possible, so I had to use a sql query directly, but this is the second time of 3 year of nhibernate usage I had to use native sql. 
  
  
http://forum.hibernate.org/viewtopic.php?t=989057&amp;sid=918dd164816d8fba3158fd2389306660
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment3</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment3</guid><pubDate>Thu, 07 Aug 2008 06:24:00 GMT</pubDate></item><item><title>Tudor commented on NHibernate Worst Practice - SQL</title><description>Using stored procs or views when it's not necessary (like Ayende said - for queries that the programmer doesn't know how to write in HQL) has the same disadvantages (just that the SQL code is somewhere else) ...
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment2</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment2</guid><pubDate>Thu, 07 Aug 2008 06:17:25 GMT</pubDate></item><item><title>pete w commented on NHibernate Worst Practice - SQL</title><description>no kidding huh? 
  
there are 1001 ways to avoid going that route. stored procs/udfs/views add a nice layer of indirection between he server and database internals
</description><link>http://ayende.com/3495/nhibernate-worst-practice-sql#comment1</link><guid>http://ayende.com/3495/nhibernate-worst-practice-sql#comment1</guid><pubDate>Thu, 07 Aug 2008 01:54:39 GMT</pubDate></item></channel></rss>