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

Delete records from table in many to many relationship?

I am using hibernate many to many association. i have 3 tables(STUDENT,COURSE and STUDENT_COURSE). among 3 tables 2 are main tables and one table is intermediate table for providing relation ship. when record is deleted from STUDENT then…
user1016403
  • 12,151
  • 35
  • 108
  • 137
1
vote
1 answer

NHibernate inheritance question

Currently I have the following classes: class Article with properties id, title and body class Question : Article with an extra PostedBy property Then I have a table called Article with the above properties and a table called questions with an ID a…
Yannis
1
vote
1 answer

How to NHibernate Map Multiple Classes to the Same Table

Is it possible to map 2 classes to the same table? class Foo {} class Bar : Foo {} class Zap : Bar {} Foo and Bar are Fluent Nhibernate auto mapped in one session factory. All 3 classes are mapped with Fluent mappings in a different session…
gabe
  • 1,873
  • 2
  • 20
  • 36
1
vote
1 answer

Runtime Error - Named query not known - Nibernate, Oracle, C#

I have looked and many examples and Questions/Answers here on Stackoverflow and elsewhere. I do not understand why my C# does not see the Oracle SP. Any help would be appreciated. Basic goal - I have a Oracle SP (shown below) which returns a cursor…
1
vote
1 answer

Nhibernate 3.x Cascade - Doing update

I have the following mapping, but when i delete status entity the Nhibernate executes an update on child instead of delete. public StatusMap() { Property(x => x.Date); Property(x => x.Text, map => map.Type(NHibernateUtil.StringClob)); …
1
vote
1 answer

Fluent NHibernate Mapping for Table in multiple HasMany Relationships

What is wrong with my class mappings below? public class Foo { public Foo() { ActualCurve = new List(); TargetCurve = new List(); } public virtual int Id { get; set; } public virtual string Name {…
1
vote
1 answer

How to set NHibernate mappings for 2 entities which share data that is stored in another table?

Given is the following class hierarchy: Class Diagram http://img535.imageshack.us/img535/4802/personusermanager.jpg Additional info: The Person class is not abstract. A person could be a User, a Manager or something else that implements the…
1
vote
2 answers

How to call stored proc using nhibernate?

I have research about it and all solution are pointing out to one solution, to use the libe of codes below and put it int .hbm.xml file. but I do not have one. What I have is hibernate.cfg.xml and nhvalidator.cfg.xml. I have read from here :…
user742102
  • 1,335
  • 8
  • 32
  • 51
1
vote
1 answer

How to perform a join using nhibernate in MVC3

Hi i want to perform a join between to tables but i am not able to do it. Here is my classes: public class Person { public virtual LoginAccount LoginAccount { get; set; } } public class LoginAccount { //fields of LoginAccount } Mapping file…
user1274646
  • 921
  • 6
  • 21
  • 46
1
vote
1 answer

loquacious NHibernate, joined-subclass equivalent?

I am converting some old XML based NHibernate mappings to the newer 'loquacious' approach. (ClassMapping) Everything was going just great until I came upon this little guy... ...
A.R.
  • 15,405
  • 19
  • 77
  • 123
1
vote
1 answer

Fluent Nhibernate ImportType

I've literally searched high and low, and can't seem to find a recent solution for this. I'm trying to implement a un-mapped class which is a DTO from 2 tables and will be returned from a HQL statement. I can't find any examples of how to do this in…
Stuart.Sklinar
  • 3,683
  • 4
  • 35
  • 89
1
vote
1 answer

mapping many-to-many with interfaces

I've searched a lot the web, but doesn't find the right solution for my problem. Basicly I am trying to create a many-to-many relationship with properties, but as the title says it should work with interfaces instead of normal classes. these are my…
1
vote
2 answers

database column to constant value without the need for a property in the entity class with mapping by code

this is almost the same as this question except using NH's mapping-by-code. I really need the virtual properties because i also want to use SchemaExport to create the database for different rdbms without the need to create/maintain scripts for…
Firo
  • 30,626
  • 4
  • 55
  • 94
1
vote
1 answer

nhibernate mapping error

I have view width columns: ID, TREE_NODE_ID, ATTRIB_ID, INT_VALUE, DATE_VALUE, STRING_VALUE, and table: ID, PARENT_ID, TREE_ID, public interface ITreeNode { long Id { get; set; } ITreeNode Parent { get; set; } // I want to get: …
Alex
  • 11
  • 2
1
vote
1 answer

NHibernate Fluent many-to-many mapping with multicolumn primary key in junction table

I noticed the DDL that gets generated by Fluent doesn't create PK for the 2 columns that make up the table for many-to-many relationship (i.e. the junction / link / bridge table). For example (from Example.FirstProject in Fluent source), Store <--…
Zach Saw
  • 4,308
  • 3
  • 33
  • 49