So, your class is called Person and lives in an assembly called Models? No namespace? The last time I checked, NHibernate expected all classes to have a namespace. And is your .hbm.xml file an embedded resource?
RP On Thursday, August 25, 2016 at 8:40:19 PM UTC+1, [email protected] wrote: > > Hi, > > I am new to Nhibernate and would appreciate a help on the problem I got > stack. I've added new Stored Procedure to the SQL Server database, tested > it in MS SQL and it works. I then tried to add the <sql-query> tab in > Repository.hbm.xml file within my MVC solution in Visual Studio. The > Repository.hbm.xml file already has a number of <sql-query> tabs for the > existing SPs that work fine. > > When I run the application I am getting "Could not execute query \r\n[ > exec sp_TestSP]\r\n[SQL: exec sp_TestSP]". I have based my code below on > the existing stored procedures and I don't know what else to do. One thing > I've noticed that the Repository.hbm.xml file inside the bin/Debug folder > misses completely my new addition. Deleting it and re-building the > solution didn't help - still the new code missing. Can anyone please > suggest what am I missing? > > Repository.hbm.xml file: > > <sql-query name="sp_TestSP"> > <return class="Person, Models"> > <return-property column="Id" name="Id" /> > <return-property column="Name" name="Name" /> > </return> > exec sp_TestSP > </sql-query> > > Repository.cs file: > > public IList<Person> GetPersons() > { > IQuery query = Session.GetNamedQuery("sp_TestSP"); > IList<Person> results = query.List<Person>(); > > return results; > } > > I am getting the above error on the highlighted line in Repository.cs file. > > Thanks > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
