Questions tagged [nhibernate-mapping-by-code]

Mapping-by-code is NHibernate's own API by which mappings can be configured by code. Introduced in NHibernate version 3.2.

Mapping-by-code is NHibernate's own API by which mappings can be configured by code. It was introduced in NHibernate version 3.2. In a strict sense this applies to the namespace NHibernate.Mapping.ByCode. It may als pertain to NHibernate.Cfg.Loquacious, but not FluentNhibernate, which has its own tag.

158 questions
0
votes
1 answer

nHibernate Mapping issue -- Nulling, not deleting children and grandchildren

Blockquote We are using the ByCode method of mapping our data.. I have Process (Process table) object which has a List of ProcessStep (ProcessStep table) objects which in turn has a Bag of ProcessStepUser (ProcessStepUser table) objects assigned…
klkitchens
  • 1,202
  • 2
  • 16
  • 39
0
votes
1 answer

Class with parent class has many items - not possible with mapping-by-code

I'm having a problem with nHibernate: If an entity inherits from a base entity, then this child entity cannot be referenced by another entity. I have an inheritance hierarchy in my database as follows: VideoFeed IS A VisualFeed VideoFeed has many…
0
votes
1 answer

NHibernate Schema Export alters wrong tables (possible bug in NH?)

I use NHibernates schema export functionality to create and update the database. However sometimes (seems to happen on slow machines more frequently) NHibernate generates incorrect alter table scripts. I disabled the schema export and log the…
Zebi
  • 8,682
  • 1
  • 36
  • 42
0
votes
1 answer

Single column joins in NHibernate using mapping by code

Consider the following relationship between Item and ItemContent. Item ItemId ItemName ItemContent ContentId ItemId Content ContentType What I would like to do is have a Content property on Item that JOINS the Content column from ItemContent based…
Brian
  • 6,910
  • 8
  • 44
  • 82
0
votes
1 answer

Nhibernate ByCode Mapping -- How to avoid a null Many-To-One Object Map?

I'm mapping a legacy database and previously users were not required to select a country when they signed up and later added it. So there are some users who have a CountryID that is NULL. So when my many to one mapping (ByCode) tries to load up the…
0
votes
2 answers

NHibernate One-To-One mapping using Mapping by Code

I have an class structure like this: public class BaseEntity { public Guid Id { get; set; } } // CREATE TABLE Project (Id, Name) public class Project : BaseEntity { public ProjectProperties Properties { get; set; } public string Name {…
Robert Wagner
  • 17,515
  • 9
  • 56
  • 72
0
votes
1 answer

NHibernate one-to-one: null id generated for AccountDetail

I got an exception "null id generated for AccountDetail" when mapping one-to-one relationship by using many-to-one with unique constraint. Here's my SQL tables: Account(Id, Name) AccountDetail(AccountId, Remark) AccountId is both primary and…
Mouhong Lin
  • 4,402
  • 4
  • 33
  • 48
-1
votes
1 answer

Insert into SQL Server database through NHibernate 4 with Session.Save using mapping-by-code

Currently experiencing issues with Session.Save() not inserting records and producing the following exception: null id in NHModels.Domain.Activity entry (don't flush the Session after an exception occurs) at…
1 2 3
10
11