How to select top in ORM?

I hve tried to limit the returned results in ORM but unsuccessfully(= select top), I can only use Procedure to resolve this problem but this is not good because i must regenarate ORM layer each time i have a new Procedure. Can anyone give me a solution? thank you very much. :roll:

Hello ichbinvinh,

You may try using Criteria. Please call: criteria.setMaxResults()

Best regards,
Jick

hello Jick,
i use ORM.net of olero not nHibernate for ASP.NET 2.0. I must do that

DataManager dm = new DataManager(Config.Dsn);
        DataSet ds = dm.FillDataSet("SELECT TOP 5 * FROM Article ORDER BY Hits DESC", true); 
        // merge the data into DataManager 
        dm.PopulateObjectsFromDataSet(ds, "Article");
        ArticleCollection ac = dm.GetArticleCollectionFromDataSet().FilterByLangCode(BasePage.CurrentLanguage);
        DataList.DataSource = ac;
        DataList.DataBind();

thanks for reply me

If ORM could generate hbm with ‘formula’ as property element in property tag it might not need criteria.setMaxResults()