NHibernate
   HOME

TheInfoList



OR:

NHibernate is an
object–relational mapping Object–relational mapping (ORM, O/RM, and O/R mapping tool) in computer science is a programming technique for converting data between type systems using object-oriented programming languages. This creates, in effect, a "virtual object databa ...
(ORM) solution for the
Microsoft .NET The Microsoft .NET strategy is a marketing plan that Microsoft followed in the early 2000s. Steve Ballmer described it as the company's "most ambitious undertaking since Internet Strategy Day in 1995". In support of this strategy, between 2000 and ...
platform. It provides a
framework A framework is a generic term commonly referring to an essential supporting structure which other things are built on top of. Framework may refer to: Computing * Application framework, used to implement the structure of an application for an op ...
for mapping an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
domain model In software engineering, a domain model is a conceptual model of the domain that incorporates both behavior and data.Fowler, Martin. ''Patterns of Enterprise Application Architecture''. Addison Wesley, 2003, p. 116. In ontology engineering, a do ...
to a traditional
relational database A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relatio ...
. Its purpose is to relieve the developer from a significant portion of relational data persistence-related programming tasks. NHibernate is
free and open-source software Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
that is distributed under the
GNU Lesser General Public License The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
. NHibernate is a port of
Hibernate Hibernation is a state of minimal activity and metabolic depression undergone by some animal species. Hibernation is a seasonal heterothermy characterized by low body-temperature, slow breathing and heart-rate, and low metabolic rate. It most ...
.


Feature summary

NHibernate's primary feature is mapping from .NET classes to database tables (and from
CLR CLR may refer to: * Calcium Lime Rust, a household cleaning-product * California Law Review, a publication by the UC Berkeley School of Law * Tube_bending, Centerline Radius, a term in the tubing industry used to describe the radius of a bend * Cen ...
data types to SQL data types). NHibernate also provides data query and retrieval facilities. It 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.)


History

Tom Barrett started NHibernate, and later picked up by Mike Doerfler and Peter Smulovics. At the end of 2005,
JBoss WildFly, formerly known as JBoss AS, or simply JBoss, is an application server written by JBoss, now developed by Red Hat. WildFly is written in Java and implements the Java Platform, Enterprise Edition (Java EE) specification. It runs on multip ...
, Inc. (now part of
Red Hat Red Hat, Inc. is an American software company that provides open source software products to enterprises. Founded in 1993, Red Hat has its corporate headquarters in Raleigh, North Carolina, with other offices worldwide. Red Hat has become ass ...
) hired Sergey Koshcheyev, the then lead developer of NHibernate, to work full-time on its future versions. 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 procedure A stored procedure (also termed proc, storp, sproc, StoPro, StoredProc, StoreProc, sp, or SP) is a subroutine available to applications that access a relational database management system (RDBMS). Such procedures are stored in the database data dic ...
s, generics, and nullable types.


NHibernate 2.0

NHibernate 2.0 was released on 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. NHibernate 2.1 was released July 17, 2009.


NHibernate 3.0

NHibernate 3.0 was released on December 4, 2010, and is the first version to use .NET 3.5, with features such as: * Integrated
LINQ Language Integrated Query (LINQ, pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, originally released as a major part of .NET Framework 3.5 in 2007. LINQ extends the langu ...
support * Strongly typed criteria-like API called QueryOver * New AST-based parser for HQL engine * Support for lazy loading columns


NHibernate 3.2

NHibernate 3.2 was released in April, 2011. Some of the new features were: * Mapping by code: fluent configuration, .hbm.xml files are no longer required; * Subselect: ability to map SQL views as entities; * HQL paging: TAKE and SKIP on HQL; * Integrated bytecode provider: one less DLL to deploy.


NHibernate 4.0

NHibernate 4.0 was released on August 17, 2014. This version requires
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
4.0 or later.


NHibernate 5.0

NHibernate 5.0 was released on October 10, 2017. It provides support for asynchronous programming. This version requires .NET Framework 4.6.1 or later.


NHibernate 5.1

NHibernate 5.1 was released on March 17, 2018. It supports .NET Standard 2.0 and
.NET Core The domain name net is a generic top-level domain (gTLD) used in the Domain Name System of the Internet. The name is derived from the word ''network'', indicating it was originally intended for organizations involved in networking technologies ...
2.0.


NHibernate 5.2

NHibernate 5.2 was released on December 4, 2018.


NHibernate 5.3

NHibernate 5.3 was released on July 19, 2020.


Contributions

As
open source software Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Open ...
, NHibernate has received many contributions from its users. Implementation of
LINQ Language Integrated Query (LINQ, pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, originally released as a major part of .NET Framework 3.5 in 2007. LINQ extends the langu ...
has allowed Language Integrated Query use with NHibernate.


NHibernate Profiler

The NHibernate Profiler is an Object–Relational Mapping tool (ORM) that serves as a real-time visual debugger for NHibernate. It identifies inefficient SQL data queries to eliminate unnecessary work by the database to boost overall performance of the application. The NHibernate Profiler also alerts users to data queries that cost too much in time and directs them to the exact line in the C# code.


Sample

Here a code snippet to add an object to the database and shows how to retrieve, modify and update an object in the database using NHibernate. //Add a Customer to the datastore //'sessionFactory' is a thread-safe object built once per application lifetime (can take seconds to build) //based on configuration files which control how database tables are mapped to C# objects //(e.g. which property maps to which column in a database table) // //'session' is not thread safe and fast to obtain and can be thought of as a connection to the database using (var session = sessionFactory.OpenSession()) //Retrieve the Customer from the database, modify the record and update the database using (var session = sessionFactory.OpenSession()) NHibernate's configuration may affect when NHibernate executes SQL statements.


See also

*
List of object–relational mapping software This is a list of well-known object–relational mapping software. It is not up-to-date or all-inclusive. Java *Apache Cayenne, open-source for Java *Apache OpenJPA, open-source for Java * DataNucleus, open-source JDO and JPA implementation (forme ...
* .NET Persistence API (NPA)


References


Bibliography

* * * *


External links


NHibernate homepage
{{DEFAULTSORT:Nhibernate Free software programmed in C Sharp .NET programming tools .NET object-relational mapping tools Object-relational mapping