what mean, for you, "magic string"? if you will have an exception, for a wrong query, during the start-up of your application, in your opinion, is an HQL a "magic string"?
P.S. If you have, at least, a test for that query perhaps a "magic string" can be only a mirage. -- Fabio Maulo El 06/12/2010, a las 21:14, W3Max <[email protected]> escribió: > Can you help me with this query (I'm using NHibernate 3 + > FluentNhibernate AutoMappings) > > Copied from stackoverflow : > http://stackoverflow.com/questions/4351683/how-can-i-do-this-query-with-nhibernate > > How can I do this query with NHibernate > > select top 10 count(distinct classedition.createdby_id) as editions, > class.id, > class.name, class.createdon, class.createdby_id > from class > inner join classedition on class.id = classedition.class_id > group by class.id, class.name, class.createdon, class.createdby_id > order by editions desc, class.createdon desc > > I'm using NHibernate 3. I tried to do it with the new Linq provider > without success. I don't care about the way of doing it as long as it > produce the exact sql query above. I would prefer writing a strongly > typed query, without magic string if possible. > > I'm new to NHibernate so this question may be simple. > > Here is a little more info > > I use Fluent NHibernate with AutoMappings. The C# classes are very > simple: > > public class Class > { > public virtual int Id { get; set; } > public virtual string Name { get; set; } > public virtual DateTime CreatedOn { get; set; } > } > > public class ClassEdition > { > public virtual int Id { get; set; } > public virtual Class Class { get; set; } > public virtual User CreatedBy { get; set; } > } > > public class User > { > public virtual int Id { get; set; } > public virtual string Name { get; set; } > } > > -- > 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. > -- 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.
