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>
SQL Tutorial, SQL Server, SQL Statement, SQL Query, MS SQL 2000 Reporting Service, T-SQL, SQL Function, SQL Syntax, SQL User Define Function, SQL Trigger
Thursday, August 21, 2008
Saturday, August 9, 2008
NHibernate
NHibernate is a port of Hibernate Core for Java to the .NET Framework. It handles persisting plain .NET objects to and from an underlying relational database. Given an XML description of your entities and relationships, NHibernate automatically generates SQL for loading and storing the objects. Optionally, you can describe your mapping metadata with attributes in your source code.
NHibernate uses the following ways to retrieve objects from the database:
NHibernate
NHibernate uses the following ways to retrieve objects from the database:
- Hibernate Query Language (HQL)
- Query By Criteria (QBC) and Query BY Example (QBE) using Criteria API
- Native SQL queries
NHibernate can work on these Database
- Microsoft SQL Server 2005/2000
- Oracle
- Microsoft Access
- Firebird
- PostgreSQL
- DB2 UDB
- MySQL
- SQLite
NHibernate
Subscribe to:
Posts (Atom)