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
0
votes
1 answer

Trying to delete remove an nhibernate collection with check constraint

SQL Server: Table Name : Dad Fields: Id Table Name : Mom Fields: Id Table Name: Child Fields: Id, IdDad, IdMom Child Check Constraint: IdDad is not null or IdMom is not null NHibernate mapping class public class ChildBase { public int Id { get;…
manuellt
  • 669
  • 2
  • 7
  • 19
0
votes
1 answer

To make a primary key in one class as foreign key in another class using mapping file of nhibernate

Hi i am developing an application in MVC using n-hibernate The application is AskQuestion forum where on the First Page a list of questions are displayed and on click of these questions another page opens which shows the answers of the…
user1274646
  • 921
  • 6
  • 21
  • 46
0
votes
1 answer

To insert a value in foreign key in mvc3 nihibernate

I am making an application named Question-Answer Forum using nhibernate in mvc3 One the first page i have a list of questions displayed as link and when i click on the click it directs me to the answers page. Table Structure: Questions…
0
votes
1 answer

NHibernate collection mapping problem

I'm trying to map a relatively simple parent-children (Invoice-InvoiceEntry) scenario in NHibernate. Here are some parts of my mapping files: from Invoice.hbm.xml
trendl
  • 1,139
  • 1
  • 10
  • 17
0
votes
2 answers

NHiberate mapping question

I have 2 entities- Classroom and Section, that I need help with NHibernate mapping. A Classroom has a collection of Sections. And the Section has a reference back to its owner Classroom. On the code side: public class Classroom { public int Id…
Rohit Agarwal
  • 4,269
  • 3
  • 27
  • 22
0
votes
1 answer

NHibernate one-to-many example. Is this a code smell?

Recently I've found an example on NHibernate's one-to-many relationship. The mapping goes like this:
CMPerez
  • 905
  • 1
  • 10
  • 25
0
votes
1 answer

NHibernate many-to-many saves duplicate data

I'd like to save books with tags. My problem is, the same tag in two books is saved twice. My classes: public class Book { public virtual long ID { get; set; } public virtual string Title { get; set; } protected ICollection _Tags =…
Florian
  • 467
  • 4
  • 8
0
votes
1 answer

Oracle user equivalent in SQL Server Compact in NHibernate

I'm using NHibernate to access both an Oracle and a SQL Server CE database. I'm syncing the Oracle db to SQL Server CE to be able to use the program offline. I'm forced to use the user concept in Oracle an does so by the "."-notation in the map…
Markus
  • 3,297
  • 4
  • 31
  • 52
0
votes
1 answer

NHibernate Entity mapping

I have an object MainObject which is related to around 20 other objects. These 20 other objects - RelatedObject1, RelatedObject2, etc. The relationship with the MainObject is defined as follows. 1 instance MainObject - > N instances of…
Nisha_Roy
  • 424
  • 2
  • 9
  • 15
0
votes
1 answer

Fluent NHibernate Map Address Type

I have a Customer table and an AddressTable. My table looks like this : Table Customer { ID, Name } Table Address { ID, CustomerID, AddressType, Address } (AddressType is 1 for HomeAddress and 2 for WorkAddress) In my Customer class I have 2…
SerhaD
0
votes
1 answer

NHibernate Session refresh call on baseclass object causes invalid cast exception

I am using the following fluent mapping for two classes : 1.Application class : public ThirdPartyAppMap() { Schema("Data"); Id(x => x.ThirdPartyAppId).GeneratedBy.Identity(); Map(x => x.AppName); Map(x =>…
James Roeiter
  • 861
  • 1
  • 9
  • 23
0
votes
1 answer

Nhibernate mapping / design issue

This issue is either due my poor project design, my lack of knowledge of how to use nhibernate, or both (just a note, I blame nhibernate for my poor project design). Here it is: In my domain model, I have the following (I've cut out a lot of excess…
MattyZ
  • 169
  • 1
  • 12
0
votes
1 answer

MVC3 + NHibernate 3.2: How to configure and map NHibernate with Web.config and Global.asax with Model - first approach

I started learning NHibernate since 2 weeks and i've read the book NHibernate 3 beginners guide. Unfortunately the book is written on the 3.1 version of it and since 3.2 some things has changed. No castle support anymore, .. I had hoped to find some…
Gigi2m02
  • 1,238
  • 3
  • 17
  • 33
0
votes
1 answer

How can I insert a table row with a FK referencing an enum equivalent db table in Fluent Nhibernate‏

I hope you can help with my scenario. I have two db tables. The first one is called status and does not change. It contains two columns, one for the ID and another called status which contains the values "Queued", "In Process" "Treated" The second…
beaumondo
  • 4,862
  • 7
  • 29
  • 42
0
votes
1 answer

NHibernate: Map two collections to one table?

I'm trying to create a parent entity (Policy) with two child-entity collections (ExpressionRules and ThresholdRules) where the types of the child-entities are the same and exist in the same table. For example: class Policy { ICollection
joniba
  • 3,339
  • 4
  • 35
  • 49