NHibernate

NHibernate
NHibernate
Stable release 3.2.0 / July 30, 2011; 3 months ago (2011-07-30)
Written in C#
Operating system Cross-platform
Platform .NET 1.1 or 2.0 or 4.0 and Mono
Type Object-relational mapping
License GNU Lesser General Public License
Website nhforge.org

NHibernate is an object-relational mapping (ORM) solution for the Microsoft .NET platform: it provides a framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a significant portion of relational data persistence-related programming tasks. NHibernate is free as open source software that is distributed under the GNU Lesser General Public License. NHibernate is a port of the popular Java O/R mapper Hibernate to .NET. NHibernate provides transparent persistence for Plain Old CLR Objects (POCOs). The only strict requirement for a persistent class is a no-argument constructor, which does not have to be public. (Proper behavior in some applications also requires special attention to the Equals() and GetHashCode() methods.[1])


Contents

Feature summary

NHibernate's primary feature is mapping from .NET classes to database tables (and from CLR data types to SQL data types). NHibernate also provides data query and retrieval facilities. NHibernate generates the SQL commands and relieves the developer from manual data set handling and object conversion, keeping the application portable to most SQL databases, with database portability delivered at very little performance overhead.

NHibernate provides transparent persistence for Plain Old CLR Objects (POCOs). The only strict requirement for a persistent class is a no-argument constructor, which does not have to be public. (Proper behavior in some applications also requires special attention to the Equals() and GetHashCode() methods.[1])

History

NHibernate was started by Tom Barrett, and later picked up by Mike Doerfler and Peter Smulovics. Now Fabio Maulo is the project leader. At the end of 2005, JBoss, Inc. (now part of Red Hat) hired Sergey Koshcheyev, the then lead developer of NHibernate, to work full-time on its future versions.[2] At the end of 2006 JBoss stopped the support to this project; it is now entirely developed and led by the community.

Version 1.0 mirrored the feature set of Hibernate 2.1, as well as a number of features from Hibernate 3.

NHibernate 1.2.1, released in November 2007, introduced many more features from Hibernate 3 and support for .NET 2.0, stored procedures, generics, and nullable types.

NHibernate 2.0 was released August 23, 2008. It is comparable to Hibernate 3.2 in terms of features. With the version 2.0 release, NHibernate dropped support for .NET 1.1.[3]

NHibernate 2.1 was released July 17, 2009.


NHibernate 3.0 was released on December 04, 2010 and is the first version to use .NET 3.5. Introduces integrated LINQ support and also strongly typed criteria-like API called QueryOver, new AST-based parser for NHibernate's HQL (Hibernate Query Language) engine, support for lazy loading columns.

NHibernate 3.2 has been released recently.

What is new in NHibernate 3.2

Some of the new Features are [4]

  • Mapping by code: fluent configuration, no more .hbm.xml files required;
  • Subselect: ability to map SQL views as entities;
  • HQL paging: TAKE and SKIP on HQL;
  • Integrated bytecode provider: one less DLL to deploy.

Contributions

As open source software, NHibernate has received many contributions from its users. Most of them are directly integrated as internal features. Others are provided by the users as utilities and documentation.

Implementation of LINQ has allowed Language Integrated Query use with NHibernate.[5]

Sample

Here a code snippet to save and retrieve an object using NHibernate:

////Save a Customer
using (var session = sessionFactory.OpenSession()) 
{
    using (ITransaction transaction = session.BeginTransaction()) 
    {
        session.Save(new Customer { Id = Guid.NewGuid(), FirstName = "Bill", Age = 50 });
        transaction.Commit();
    }
}
 
////Retrieve the Customer
using (var session = sessionFactory.OpenSession()) 
{
    var customer = session.Query<Customer>().Single(c => c.Id == id);
}

See also

References

Bibliography

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • NHibernate — Тип Object relational mapping Разработчик JBoss Операционная система Cross platform Последняя версия 3.3.1 (12 июня 2012 года) Лицензия GNU Lesser General Public License …   Википедия

  • NHibernate — es la conversión de Hibernate de lenguaje Java a C# para su integración en la plataforma .NET. Al igual que muchas otras herramientas libres para esta plataforma, NHibernate también funciona en Mono. Al usar NHibernate para el acceso a datos el… …   Wikipedia Español

  • NHibernate — Hibernate Hibernate est un framework open source gérant la persistance des objets en base de données relationnelle. Hibernate est adaptable en termes d architecture, il peut donc être utilisé aussi bien dans un développement client lourd, que… …   Wikipédia en Français

  • NHibernate — Hibernate (Framework) Entwickler: JBoss (Red Hat) Aktuelle Version: 3.3.1 (11. September 2008) Betriebssystem: plattformübergreifend Kategorie …   Deutsch Wikipedia

  • Hibernate — Développeur Red Hat Dernière version 3.6.7 Final (17 août …   Wikipédia en Français

  • Language Integrated Query — LINQ redirects here. For the card game, see Linq (card game). Language Integrated Query Influenced by SQL, Haskell Language Integrated Query (LINQ, pronounced link ) is a Microsoft .NET Framework component that adds native data querying… …   Wikipedia

  • Hibernate (Framework) — Hibernate Entwickler JBoss (Red Hat) Aktuelle Version 3.6.8 (27. Oktober 2011) Aktuelle Vor …   Deutsch Wikipedia

  • Hibernate Query Language — Hibernate (Framework) Entwickler: JBoss (Red Hat) Aktuelle Version: 3.3.1 (11. September 2008) Betriebssystem: plattformübergreifend Kategorie …   Deutsch Wikipedia

  • Hibernate — Este artículo o sección sobre informática necesita ser wikificado con un formato acorde a las convenciones de estilo. Por favor, edítalo para que las cumpla. Mientras tanto, no elimines este aviso puesto el 29 de marzo de 2010. También puedes… …   Wikipedia Español

  • Hibernate (библиотека) — У этого термина существуют и другие значения, см. Hibernate. Hibernate Тип Object Relational Mapping Разработчик Red Hat Написана на Java …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”