Hi, i posted yesterday my question on stackoverflow but there nobodoy answered me. Therefore i try here;)
If someone want see formated question here is my post: http://stackoverflow.com/questions/6219921/populating-entities-from-stored-procedures-with-nhibernate-could-not-execute-qu Today I have made some example of code responsible for populating entity from stored procedure, and I had such an exception could not execute query [ exec GetProducts @p0 ] and the inner exception presented laconic message x1_0_ I lost a lot of time to find solution that is very incomprehensible for me. First I show you the fragments of code: Here is the entity: public class Product { public virtual int Id { get; private set; } public virtual string Name { get; set; } public virtual double Price { get; set; } public virtual double x { get; set; } } And here is mapping for Product entity: public class ProductMap : ClassMap<Product> { public ProductMap() { Id(x => x.Id); Map(x => x.Name); Map(x => x.Price); Map(x => x.x); } } HBM.xml file with query name: <sql-query name="GetProduct"> <return class="Product"> <return-property column="a" name="Id" /> <return-property column="n" name="Name" /> <return-property column="p" name="Price" /> </return> exec GetProducts :lol </sql-query> Procedure: create procedure GetProducts @mid int -- i know i don't use it AS select Name as n, Price as p, Id as a from dbo.Product Execute code looks like: IQuery query = session.GetNamedQuery("GetProduct"); query.SetInt32("lol", 1); IList<Product> products = query.List<Product>(); And why when I run query.List() method code is throwing exception? Because there is no mapping "return property" for property x of product entity. And here is my question Why I have to map all properties of entity in query name return-property. I didn't find anything about that in documentation. And i don't want to do that. Regards -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
