NHibernate is equipped with an extremely powerful query language that looks very much like SQL. Hibernate Query Language (HQL) is fully object-oriented, understanding notions like inheritence, polymorphism and association.
The simplest possible Hibernate query is of the form:
- "From Employee" - (similar to SQL "Select * From Employeetbl"
* Employee is a mapping class
if you map the table Employeetbl to a mapping class, so you can use the HQL to select from the mapping file.
Example of Mapping Class for NHibernate
<class table="Employeetbl" name="Employee" lazy="false">
<id type="string" column="Employeeid" name="Employeeid">
<generator class="increment">
</id>
<property type="string" column="EmployeeName" name="EmployeeName"></property>
</class>