5
votes
1answer
2k views

Issue with Casting proxies when using NHibernate table per subclass inheritance strategy

I have got an abstract base class and inherited poco entities. I am using table per subclass inheritance with fluent nhibernate 1.1 automapping. The class inheritance looks like follows Node ...
7
votes
1answer
3k views

NHibernate creates proxy via session.Load(), but not via Linq or Criteria API

I have an odd problem in my current project. Lazy loading for queries does not work. When I query a list, nhibernate fetches all associations separately. I extracted small parts of it and put it into ...
1
vote
1answer
183 views

NHibernate: Lazy loading of IUserType

Say we have a system that stores details of clients, and a system that stores details of employees (hypothetical situation!). When the EmployeeSystem access an Employee, the Client information is ...
13
votes
1answer
2k views

Paging over a lazy-loaded collection with NHibernate

I read this article where Ayende states NHibernate can (compared to EF 4): Collection with lazy=”extra” – Lazy extra means that NHibernate adapts to the operations that you might run on top ...
5
votes
5answers
2k views

When should one avoid using NHibernate's lazy-loading feature?

Most of what I hear about NHibernate's lazy-loading, is that it's better to use it, than not to use it. It seems like it just makes sense to minimize database access, in an effort to reduce ...
4
votes
3answers
2k views

Lazy-loaded NHibernate properties in Equals and GetHashCode

How can the following problem be dealt with? We're using lazy loaded NHibernate properties and whenever we're calling Equals() or GetHashCode() any properties used, will be lazy-loaded, potentially ...
2
votes
1answer
4k views

NHibernate: can't successfully set lazy loading

I have a table Parent and a table Child. Child contains a foreign-key to the Parent table, creating a one-to-many relationship. Here is a part of my mapping that I define with fluent NHibernate: ...
3
votes
2answers
3k views

NHibernate exception: method Add should be 'public/protected virtual' or 'protected internal virtual'

Take this class as example: public class Category : PersistentObject<int> { public virtual string Title { get; set; } public virtual string Alias { get; set; } public virtual ...
1
vote
1answer
471 views

NHibernate lazy properties behavior?

I've been trying to get NHibernate into development for a project I'm working on at my workplace. Since I have to put a strong emphasis on performance, I've been running a proof-of-concept stress ...
5
votes
2answers
10k views

NHibernate.LazyInitializationException

We have been having this issue pop up sporadically, but now I can reproduce it every time. I am incrementing a view counter on my custom built forums, which causes an error: ...
12
votes
1answer
5k views

Lazy loading not working for many-to-one relationship when mapping to a non-key field using property-ref

I have a legacy database that I am mapping using NHibernate. The objects of concern are an Account and a list of Notification objects. The objects look like: public class Notification { public ...
4
votes
2answers
903 views

NHibernate 3 lazy properties and eager queries

I'm using NHibernate 3.0.0 and the new feature lazy properties. However, in some queries I want to eagerly load the properties and I would like the query to result in non-proxied entity instances. I ...
4
votes
3answers
4k views

How to fix a NHibernate lazy loading error “no session or session was closed”?

I'm developing a website with ASP.NET MVC, NHibernate and Fluent Hibernate and getting the error "no session or session was closed" when I try to access a child object. These are my domain classes: ...
1
vote
4answers
1k views

NHibernate Lazy Initialized collection on WCF Wire

My object looks something like this: class { int a; object b; IList<string> c; } All the fields are getting populated from the database and the collection is getting lazy ...
6
votes
2answers
6k views

How to use NHibernate Projections to retrieve a collection

I am lazy loading the collections, and also because there are so many fields within the person table, I am writing a projection function to retrieve only certain properties. It works with properties, ...

1 2
15 30 50 per page