http://nhforge.org/blogs/nhibernate/archive/2008/11/23/populating-entities-from-stored-procedures-with-nhibernate.aspx
2009/3/25 graphicsxp <[email protected]> > > I've figured out the issue, my stored procedure is not returning the > same number of columns as what I've mapped in my class. Does this mean > I can't create a Cutting object from the stored procedure without > mapping ALL the fields again in each stored procedure !? > > On 25 mar, 12:29, graphicsxp <[email protected]> wrote: > > I've debugged nhibernate, and in the function GetNamedQuery, the > > IQuery object that is returned contains a ReturnTypes property which > > throws an exception : > > > > query must begin with SELECT or FROM: exec [exec sp_NH_GetCuttings] > > > > Whatever that means.... Can someone help ? > > > > On 25 mar, 09:46, graphicsxp <[email protected]> wrote: > > > > > Hi, > > > > > I get an exception while calling a named query : > > > > > <sql-query name="sp_NH_GetCuttings"> > > > <return class="DataTransfer.Cutting, DataTransfer" > > > > <return-property name="Cuttingid" column="CuttingID" /> > > > <return-property name="Headline" column="Headline" /> > > > </return> > > > exec sp_NH_GetCuttings > > > </sql-query> > > > > > public IList<Cutting> getCuttings() > > > { > > > return _session.GetNamedQuery("sp_NH_GetCuttings").List<Cutting> > > > (); > > > } > > > > > The exception inner message is not helpful : > > > > > could not execute query > > > [ exec sp_NH_GetCuttings ] > > > [SQL: exec sp_NH_GetCuttings] > > > > > and if I go deeper : > > > > > column2_0_0_ > > > > > The second one is even more useless... > > > > > Here's the stored procedure : > > > > > CREATE PROCEDURE sp_NH_GetCuttings > > > > > AS > > > BEGIN > > > SELECT TOP 3 CuttingID, Headline FROM cutting > > > END > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
