Hello,
For example suppose I am working with Customer table of Northwind database.
I have a stored procedure named "GetCustomers" that selects CustomerID,ContactTitle,CompanyName from the customers table,
I have created a named query like:
<sql-query name="GetCustomers">
<return class="Domains.Customer, Domains" />
exec GetCustomers
</sql-query>
but the problem is an exception is generated telling that there are some wrong column name.
AND When i Select ALL the columns the query works correctly.
I also tried:
<sql-query name="GetCustomers">
<return class="Domains.Customer, Domains" >
<return-property name="CustomerID" column="CustomerID" type="String" />
<return-property name="ContactTitle" column="ContactTitle" type="String" />
<return-property name="CompanyName" column="CompanyName" type="String" />
</return>
exec GetCustomers
</sql-query>
The exception is also generated, I can only have it done if i used <return-scalar /> instead; but this will return a list of objects or object[] not the mapped entity.
Why Nhibernate cannot select some columns into the mapped entity and leave the rest columns with their default values?
Is there any way to come over this issue?
Thanks in advance!!
|