Questions tagged [nhibernate-mapping]

XML mappings for the .NET framework object-relational mapper (ORM) NHibernate as created with .hbm.xml files.

NHibernate mappings done in XML files indicate how classes map to database objects. Refer to the relevant NHibernate reference section for details on how to create such mappings.

2300 questions
12
votes
4 answers

How does one make NHibernate stop using nvarchar(4000) for insert parameter strings?

I need to optimize a query that is being produced by a save (insert query) on a domain entity. I've configured NHibernate using Fluent NHibernate. Here's the query generated by NHibernate during the insertion of a user's response to a poll: exec…
12
votes
1 answer

NHibernate One-To-One Mapping

I'm new to NHibernate so have had limited exposure to mappings etc so far, and I've just hit a scenario which I need some help with. I have 2 tables: Reviews TaggedReviews I have 2 classes that look like this (I've excluded non-important properties…
marcusstarnes
  • 6,393
  • 14
  • 65
  • 112
12
votes
3 answers

Fluent nHibernate automapping property as nvarchar(max)

using fluent nhibernate, and automappings (nhibernate creates my db schema), how can i get nhibernate to create a nvarchar(max) column in the database based on the following class public class VirtualPage : BaseEntity { public virtual int…
stoic
  • 4,700
  • 13
  • 58
  • 88
12
votes
1 answer

IndexOutOfRangeException Deep in the bowels of NHibernate

I have the following mappings: public class SecurityMap : ClassMap { public SecurityMap() { Table("Security"); CompositeId().KeyProperty(k => k.Id, "SecurityId").KeyProperty(k => k.EndDate); …
NotMyself
  • 29,209
  • 17
  • 56
  • 74
12
votes
5 answers

Why Fluent NHibernate vs. hbm XML files?

While this is a subjective question, as a new NHibernate user, I'm curious as to why one would choose Fluent vs traditional XML mapping. From my standpoint, when I first worked with NHibernate, I used the Fluent interface, but ran into some…
Bob Palmer
  • 4,714
  • 2
  • 27
  • 31
12
votes
2 answers

NHibernate mapping by code (Loquacious) - Cascade options

I have a question on Cascade enum options behavior when using NHibernate Mapping By Code. Enum has following options: [Flags] public enum Cascade { None = 0, Persist = 2, Refresh = 4, Merge = 8, Remove = 16, Detach = 32, …
Cortlendt
  • 2,190
  • 4
  • 29
  • 50
12
votes
1 answer

Fluent Nhibernate Mapping for Sql Views

i am using Fluent Nhibernate in asp.net mvc3 with c# i am working in following way to generate and map a class Mapping using FluentNHibernate.Mapping; using Com.Web.Domain; namespace Com.Web.Mapping { public class CompanyMap :…
11
votes
5 answers

The ProxyFactoryFactory was not configured

Considering this example as a base example, I created the application but when I execute this application I am getting the following error. The ProxyFactoryFactory was not configured. Initialize 'proxyfactory.factory_class' property of the…
11
votes
2 answers

nhibernate many-to-many mapping - additional column in the mapping table?

I have following mapping definitions:
Greg
  • 565
  • 1
  • 5
  • 13
11
votes
1 answer

Understanding foreign key not-null=true and inverse behavior in a zero-to-one relationship with NHibernate

I'm trying to get NHibernate to use the many side of a collection to manage a bidirectional association to model a zero-to-one relationship. Parent Class and Map: public class Parent { private ICollection children; public Parent() …
rbellamy
  • 5,683
  • 6
  • 38
  • 48
11
votes
1 answer

Fluent NHibernate generates extra columns

We are using Fluent NHibernate for data object model in the company i work. A couple of days ago, we encountered an issue that Fluent NHibernate generates an extra column which does exist neither in model nor in mapping. Here is the situation: My…
11
votes
2 answers

IPreUpdateEventListener and dynamic-update="true"

I have been trying to do a very simple auditing scenario following Ayende's blog which seem to be the resource everyone is refering to when it comes to IPreUpdateEventListener and IPreInsertEventListener. However no matter how hard I tried, I…
ds99jove
  • 618
  • 2
  • 7
  • 21
11
votes
2 answers

Fluent NHibernate N+1 issue with complex objects

I'm having a problem with NHibernate querying the database way too many times. I just realized it likely relates to the n+1 problem but I can't figure out how to change my mappings to solve the problem. As you will see, my attempts involve…
Morten Salte
  • 505
  • 5
  • 21
11
votes
1 answer

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 (abstract class) Place : Node Asset : Node Node class is…
11
votes
1 answer

Anyone know of any decent resources on Stored Procedures for Fluent Nhibernate 1.1

A recent release of Fluent Nhibernate (1.1) now supports stored procedures. I was wondering if anyone out there has found any good blog articles on how to do this! I am not asking about using classic hbm mappings instead which these questions…
Aim Kai
  • 2,934
  • 1
  • 22
  • 34