nhibernate-mapping

NHibernate Mapping Generator is redundantly defining columns from Oracle

I'm using the latest NMG version 2.0 RC1 to generate Fluent mappings for an Oracle 10g database. Unfortunately it is detecting multiple instances of many of the database columns, so my output includes up to 5 definitions for each column, all with the same name. I am working with hundreds of tables, so I really do not want to go through...

NHibernate: Same class for joined tables

I have a mapping that work to retrieve all sales order headers and their sales order lines in a IList: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping ...> <class name="salesH" table="SalesHeader" lazy="false"> <id name="No" column="No_" type="string"></id> <property name="OrderDate" column="OrderDate" type="DateTim...

Why doesn't session.CreateCriteria(typeof(...)) fail for an unmapped type?

For every entity that I create I write a unit test that just loads one record from the database to see if the query works and the data can be set on the entity correctly. You could see this as a unit test for the basic mapping. This should also confirm that a mapping file exists for the type and is set as embedded resource. The test loo...

NHibernate Mapping Attributes + Dirty Checking

Hello everyone ! I have problems with NHibernate updating some of my entities when this is not supposed to happen (dirty checking). As I use NHibernate.Mapping.Attributes to map my classes, I have found that there is a parameter "Check" to the element "Class" of NHMA. I would like to know if I can turn off dirty checking by setting thi...

NHibernate - How to map users belonging to both accounts and stores?

Hi, We have many accounts and an account can have many stores and now I have users. A user could potentially belong to either an account or a store. Like below I just feel like this is insanity and was hoping for some guidance in the matter. These are my requirements. A user belonging to an account should have access to all the stor...

nhibernate: many-to-one using multiple columns

So I have scavenged the internet for a while now and am still stumped on this current issue I am facing with nHibernate: I have two tables that I have mapping files for. Table A stores information about "Things", and Table B stores how these "Things" are related. The problem is as follows. Table A is mapped to the Thing class. Table B n...

C# mvc2 nhibernate problem

I've got the following mapping in my application. The mapping is generated, by a custom tool. Other mappings generated work ok, but this one is giving me a strange error which I don't understand. This is the mapping; <?xml version="1.0" encoding="utf-8"?> <!--Generated by NHibernate.Mapping.Attributes on 2010-10-29 08:39:48Z.--> <hiber...

Have NHibernate fetch certain properties on each invoke

Normally, when you define a mapping for a certain property of a class, NHibernate saves the value in the property as soon as it has been fetched. Either it's fetched immediately when getting the object, or it's lazily loaded on the first invoke of the getter of the property, but once it has been loaded from the database it's fetched. Pl...

How can I get a list of entities in NHibernate where the ParentId might refer to different tables

I'm new to NHibernate so I'm sure that I'm just missing something fundamental. I have an table called Issue that has a ParentId column. The ParentId can refer to different tables (i.e. - Project or Customer, etc.) How can I do that query in NHibernate so that I can show only the Issues that belong to Project. Here is what I've tried....

Nhibernate Component Mapping : Parent Object null in Value Object while querying from database

Hello, I am mapping my value Object Item as component withthe folowing mapping configuration { Table("Product"); Not.LazyLoad(); Id(x => x.Id, "id"); Map(x => x.Number, "number"); Map(x => x.Name, "name"); Map(x => x.Description, "description"); Map(x =...