nhibernate-collections

Fetch child without primary key NHibernate

I am trying to get a collection of objects into a parent object through mapping. I have a parent object "ScoreCard" whose primary key is a guid (Id) and a child "Score" object whose primary key is a guid (Id). I want to select the child objects for the parent based on two fields that both objects have but I can't get it to work, here's ...

NHibernate criteria on lazyload

Can anyone tell me if it's possible to add criteria to an NHibernate lazy loaded collection. For example let's say I have a department that contains employees... I get the department by id and then I lazy load the employees... however lets say there are 1000's of employees and I only want the employees that were hired in the last 30 d...

Using NHibernate Collection Filters with DDD collections

I am trying to map a domain model in NHibernate. The domain model is implemented with what I think is DDD style. The mapping works mostly but then when I try to use a collection filter on an a collection I get an exception which says: The collection was unreferenced. I know the problem comes from how I've implemented the collection. My ...

Updating the collections of entities with NHibernate the correct way

A simple question regarding how NHibernate works: I have a parent entity that has a collection of other child entities. Those child entities have a reference to the parent entity they belong to. Now I want to implement an Add method to the parent entity that would add a child to it. Should that Add method only add the child to its new pa...

NHibernate - Sorting Entities based on Property/Column + how to manage?

I'm writting an ASP.NET MVC e-commerce app using NHibernate and I want the end-user to be able to control the ordering of Product Categories (not just have them appear alphebetically etc.). Normally, I'd add an OrderIndex/Sort column (of type int) to the Category table, and property to the Category domain class. But the problem is in ha...

NHibernate Collection Mapping Help

I have a root object, Policy, that has a compositeKey of PolicyNumber/PolicyDate. The Policy has a one-to-many collection of PolicyDetails which have a composite key of PolicyNumber/PolicyDate/Sequence. Sequence is an assigned value that is set by the application. My Mapping for Policy is below. I'm able to do a get and populate my c...

NHibernate custom collection type

Hi, I'm having an entity object called Patient and this entity is having a property called Visits which is of type VisitsCollection. VisitsCollections is a child class of IList<Visit> but it also adds some custom logic to the collection (like auto ordering, some validation, notifications, etc..). I need to use the custom collection ty...

Unusual NHibernate collection/inheritance mapping

Hi! Here are my relevant classes: public class ArticleMetadata { public long ID { get; set; } public string Slug { get; set; } } public class Article : ArticleMetadata { // This is a massive CLOB, hence separate class public string Content { get; set; } } public class Section { public long ID { get; set; } p...