Try this:
Code:
<sql-query name="load" read-only="true">
<return alias="h" class="MyCode.House, MyCode"></return>
<![CDATA[
select distinct ID as {h.Id}, NAME as {h.Name} FROM HOUSES_VIEW
]]>
</sql-query>
Quote:
I did already use HOUSES_VIEW in the named sql query. When executing the query, it still won't work, issuing an SQL command using ... FROM House hous_0. An NHibernateADOException is issued, specifying the table does not exist.
What do you mean with query ? As I said, when you use HQL or a criteria, the custom SQL will NOT be used. If you need to be able to run flexible queries against the view, you have to map the view itself (or in your case define another view with unique rows).