Questions tagged [nhibernate]

NHibernate is an open source object-relational mapper (ORM) for the .NET framework.

NHibernate is an open source object-relational mapper (ORM) for the .NET framework.

It started as a .NET port of the popular Java ORM Hibernate.

Installation

Installing NHibernate can most easily be done using its NuGet package:

Install-Package NHibernate 

Resources

17517 questions
5
votes
1 answer

Struggling to Comprehend nHibernate SchemaUpdate, even with Blog Posts

I've seen the various blog posts concerning nHibernate's SchemaUpdate, and even Ayende's very good example, and downloaded the samples, but for some reason I cannot get the same same thing to work for me. I will note that I am using Fluent…
Ciel
  • 17,312
  • 21
  • 104
  • 199
5
votes
1 answer

Collection cannot be null exception when using HashSet in NHibernate

I have the following in my NHibernate entity: private ICollection _stringSet = new HashSet(); public virtual ICollection StringSet { get { return _stringSet; } } Then, in my Fluent mapping I map it…
StarKat99
  • 531
  • 3
  • 15
5
votes
1 answer

NHibernate order by using CASE

I have run into a big issue on sorting using nhibernate hql. I have a table LICENSE which has a property USER (corresponding to a USER class) that links it to another table USERPROFILE. The USERPROFILE table has a property UserName which is nvarchar…
user835199
  • 335
  • 1
  • 2
  • 7
5
votes
1 answer

Is Linq to NHibernate in the 2.1 Alpha release?

So the nHibernate 2.1 Alpha came out a few days ago, but the announcement on sourceforge doesn't mention the additional features. In particular, it doesn't mention whether LINQ is included. I know that I've read that LINQ would be part of 2.1, but…
John
  • 3,332
  • 5
  • 33
  • 55
5
votes
1 answer

Selecting on Sub Queries in NHibernate with Critieria API

So I have a SQL query with the following structure: select p.* from ( select max([price]) as Max_Price, [childId] as childNodeId from [Items] group by [childId] ) as q inner join [Items] as p on p.[price] = q.[Max_Price] and p.[childId]…
GWLlosa
  • 23,995
  • 17
  • 79
  • 116
5
votes
2 answers

NHibernate inner join gives "Path expected for join"

I have three Tables: - Person - User - PersonSecret where PersonSecret reference to Person and User:
BennoDual
  • 5,865
  • 15
  • 67
  • 153
5
votes
6 answers

NHibernate won't persist DateTime SqlDateTime overflow

I am working on an ASP.NET MVC project with NHibernate as the backend and am having some trouble getting some dates to write back to my SQL Server database tables. These date fields are NOT nullable, so the many answers here about how to setup…
chris raethke
  • 425
  • 3
  • 8
5
votes
1 answer

working with Fluent NHibernate and guid ids

We're working with Fluent NHibernate 1.2 and our primary key is a guid saved in a nvarchar(32) column, working with Oracle 11gr2. How can we make this work? (making an automatic conversion...) Thanks ahead, random programmer... UPDATE: forgot to…
5
votes
1 answer

What is the usage of Session.Merge method in NHibernate?

What is the usage of Session.Merge method in NHibernate? When can we use of this method?
masoud ramezani
  • 22,228
  • 29
  • 98
  • 151
5
votes
4 answers

How to map uint in NHibernate with SQL Server 2005

I have a property of type uint on my entity. Something like: public class Enity { public uint Count {get;set;} } When I try to persist that into the SQL Server 2005 database, I get an exception Dialect does not support DbType.UInt32 What would…
Krzysztof Kozmic
  • 27,267
  • 12
  • 73
  • 115
5
votes
1 answer

NHibernate and ASP.NET Membership

I use ASP.NET MVC 3 for an application which makes heavy use or Users and Roles. To create a user and assign role(s) I use the standard process via ASP.NET Membership. Throughout the entire app I use NHibernate for the underlying data access except…
5
votes
2 answers

NHibernate Projections and "Having" clause

I'm using NHibernate to query my database with the criteria API. My criteria is below: ICriteria c = Session.CreateCriteria(typeof(Transaction)); ProjectionList projections = Projections.ProjectionList(); projections.Add(Projections.Sum("Units"),…
lomaxx
  • 113,627
  • 57
  • 144
  • 179
5
votes
3 answers

Can I (and should I) force NHibernate future queries to execute at a certain point?

I'm using NHibernate future queries in an MVC 3 web application, and trying to keep all my database access happening in my controllers, and not in my views. The site is a catalog of Resources (descriptive blurbs), which have a many-to-many…
Carl Raymond
  • 4,429
  • 2
  • 25
  • 39
5
votes
4 answers

NHibernate ThenFetchMany is retrieving duplicate children

I have a parent object with a child collection containing one element, the child collection contains a "grandchild" collection containing 3 elements. I am loading the parent object from the database using NHibernate as follows Parent parentObject =…
Simon
  • 1,499
  • 3
  • 17
  • 23
5
votes
1 answer

upgrading NHibernate and NHibernate Validator w/ Nuget

As of the today, the Nuget release of NHibernate Validator is 1.3.1.4000 and says it has a dependency >= NHibernate 3.1.0.4000, which implies it should work with latest NHib 3.2. But NHib 3.2 now has its own ProxyFactory, so running the two gets the…
Berryl
  • 12,471
  • 22
  • 98
  • 182