NHibernate的HQL的相当于T-SQL的TOP关键词 [英] NHibernate HQL's Equivalent to T-SQL's TOP Keyword

查看:210
本文介绍了NHibernate的HQL的相当于T-SQL的TOP关键词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是NHibernate的HQL的相当于T-SQL的TOP关键字?

What is NHibernate HQL's Equivalent to T-SQL's TOP Keyword?

还什么是非HQL方式说给我的前15个一类?

Also what is the non-HQL way for saying give me the first 15 of a class?

推荐答案

它实际上是美元的HQL p $ ptty的方便:

It's actually pretty easy in HQL:

var top15 = session.CreateQuery("from SomeEntity")
                .SetFirstResult(0)
                .SetMaxResults(15)
                .List<SomeEntity>();

不知道如何使用标准的API,虽然做到这一点。

Don't know how to do this using the criteria API though.

这篇关于NHibernate的HQL的相当于T-SQL的TOP关键词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆