Hi! You should only be using CreateSQLQuery for special cases, where NHibernate's own query mechanisms doesn't suffice. If you're adding WHERE and ORDERBY to the IEnumerable, that means you're fetching ALL data, and filter and sort in memory.
Do you really need CreateSQLQuery? 2014-11-21 1:55 GMT+01:00 Bryan Valencia <[email protected]>: > I have an ad hoc object type, CombinedData and a T-SQL query that fetches > the right data. I want to load a list of the CombinedData objects from the > results of the query. > > The column names in the result set do not exactly match the Object field > names. > > So far I have... > > ISQLQuery Query = myDB.Session.CreateSQLQuery(SQL); > ICollection<CombinedData> coll = Query.List<CombinedData>(); > > This fails miserably because: > > 1. it seems to be fetching ALL the data from the database (not lazy > loading) > 2. it crashes because whatever the hell is coming back, it's not a > "CombinedData" type. > > Here's what I want. > I want to get this Massive, ugly query (SQL) to push back an IENUMERABLE, > that I can then add my WHERE and ORDERBY clauses to, so that I can databind > it to a grid. > > I have googled for this and found NO EXAMPLES. > > There is some chat about AddEntity, but I have no idea what that does. > > There is some chat about SetResultTransformer but no examples of > implementing the interface. > > I am exceedingly new to NHibernate, so if you're gonna RTFM me, tell me > where the FM is that shows examples how to get there from here. > > -- > 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 http://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- 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 http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
