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
1
vote
0 answers

NHibernate update not saving for composite key

We've finally reached a point in our dev where we're performing CRUD operations, most of which works, apart from our own referenced key clean up (we're using a old-pre-designed database). The problem we're having is that our objects that have…
Stuart.Sklinar
  • 3,683
  • 4
  • 35
  • 89
1
vote
2 answers

NHibernate constraints associations of a parent class are dropped on the subclass

I think that the main issue is that the subclass deletes all constraints related to the base mapped collections. Using the table per concrete class strategy, I have found that the parent collections are not asociated with the subclasses also in…
Jesus
  • 631
  • 3
  • 13
1
vote
1 answer

Conditional fetching with NHibernate

I need to eager load an object tree with NHibernate but I also wish to specify which objects to load. The object tree is like this: class A { double Date; IList Bs; } class B { double Date; IList Bs; } class C { double…
1
vote
2 answers

NHibernate Mapping Question

I have tried various approaches to mapping the following structure, but I finally admit that after a day of not getting very far, I need some help. So the question is, how would you guys go about mapping something like this. The schema is not fixed…
Fen
  • 933
  • 5
  • 13
1
vote
1 answer

Entity, Value object or enum representation of objects within domain model

I'm trying to build a document management system and despite all the thigns i've read about entities, value objects, how to choose between how to map them etc... i still can't figure out what the "correct" way to do it is. Quite typically in such a…
Matthew
  • 817
  • 2
  • 13
  • 21
1
vote
2 answers

NHibernate configuration, foreign keys

I must admit I'm still pretty new to NHibernate, so please go easy on me. I have 2 POCOs, a Log and a UserProfile. If it is not inherently clear, the log entry can reference a user profile, and a user profile can have many log entries associated…
Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254
1
vote
2 answers

Search for equivalent Fluent Nhibernate Mapping - Mapping Map as Dictionary

I search for a equivalent Fluent Mapping for the following Attribute-based mapping in NHibernate 2.1 [Class(typeof(Article), Table = "ARTIKEL")] public class Article { [Id(0, Name = "Id", Column = "Id")] public virtual int Id { get; set; } …
Eruphus
  • 83
  • 6
1
vote
1 answer

Make NHibernate overwrite data in collection

Lets say I have a class: public class Entity { ... public IEnumerable Cousins { get; set; } } ... and I've mapped it... public class EntityMap : ClassMap { public EntityMap() { ... HasMany(x =>…
1
vote
2 answers

Nhibernate Flush causing Updates where there should be none

I am using the Repo pattern, and I have set up tests to replicate my a HTTP request coming in and then causing dispose on a unit of work once a test has completed. It appears that after executing a HQL statement, and then calling displose (which in…
Stuart.Sklinar
  • 3,683
  • 4
  • 35
  • 89
1
vote
1 answer

NHibernate Query with mapping

I am using NHibernate 3.2.0 with an Microsoft SQL Server 2005 database, C# 4.0 and the following domain: public class Foo { public virtual Guid Id { get; set; } public virtual IBar MyBar { get; set; } } public interface IBar { Guid Id {…
MartinB
  • 21
  • 1
  • 6
0
votes
1 answer

Same table NHibernate mapping

How can i go about defining a same table relation mapping (mappingbycode) using Nhibernate for instance let's say I have a class: public class Structure{ public int structureId; public string structureName; public Structure…
mircea .
  • 241
  • 5
  • 15
0
votes
2 answers

NHibernate Many to many mapping with additional columns in the mapping table

There are two tables Person and Address. I have a mapping table PersonAddressMap which contains an additional column IsCurrent other than the two foreign keys (no explicit primary key column). I have created three mapping classes one each for…
Nazgul
  • 1,974
  • 4
  • 22
  • 34
0
votes
1 answer

NHibernate 3.2 mapping by convention generating an unnecessary foreign key column

I have a couple of classes that look like this: public class Client { public int Id {get;set;} public string Name {get;set;} } public class User { public int Id {get;set;} public string Email {get;set;} public Client Client…
Chris
  • 27,596
  • 25
  • 124
  • 225
0
votes
1 answer

What is the difference between update and insert in NHibernate?

What makes NHibernate engine determine whether the command is an update or insert? The command is similar for both update and insert.
allan
  • 276
  • 3
  • 10
0
votes
1 answer

NHibrnate Mapping

I want to create tow entities for the same table without discriminator. Lets sey that my table represent Person and I would like to create 2 entity classes: Person and PersonExt. Person will contain most of the table columns like : name, Age, Adress…