开发者

How to return multiple rows in Nhibernate?

I am new to Nhibernate. I want to retrieve collection of records against an entity. For example to retrieve a single record I have used the following statement:

resultObject=session.Get(id);

This above statement would retrieve a single record bas开发者_如何学编程ed on the 'id" I provide.

But I want to retrieve multiple rows from a table the way we retrieve from the following sql statement: Select * from Student

How can I do this using Nhibernate? Please guide?


Using Criteria API

ICriteria criteria = session.CreateCriteria(typeof(Student));
criteria.List<Student>();

Using HQL

IQuery nhQuery = session.CreateQuery("FROM Student");
nhQuery.List<Student>()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜