Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Querying the workflow


NHibernate supports different ways of retrieving data from database. The basic semantics of writing a NHibernate query is no different than that of a standard SQL query which consists of the following three main parts:

  • You specify which tables are involved in query

  • You specify an optional filter using WHERE statement

  • You specify which columns you want to return using SELECT statement

There are other optional things you can add to a SQL query such as ordering, grouping, pagination, and so on, which is also supported by NHibernate. Queries written in NHibernate fundamentally differ from standard SQL queries on one aspect – composability. A query is represented by a query object. You can compose a query object by incrementally adding constructs such as joins with more tables, ordering, the where clauses, and so on. When you have finished building the query object, you call one of the terminal method on it, such as List<T> or First<T> which will tell NHibernate...