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
11
votes
3 answers

Named query not known error trying to call a stored proc using Fluent NHibernate

I'm working on setting up NHibernate for a project and I have a few queries that, due to their complexity, we will be leaving as stored procedures. I'd like to be able to use NHibernate to call the sprocs, but have run into an error I can't figure…
Hamman359
  • 1,052
  • 2
  • 14
  • 27
10
votes
4 answers

JPA lazy at simple byte[] field level

Unfortunately the code below does not work. Image is always retrieved! @Entity public Car implements Serializable { ... @Basic(fetch = FetchType.LAZY) //Neither with @Lob private byte[] image; ... } SETUP: JPA 2.0 / Hibernate 3.5…
CelinHC
  • 1,857
  • 2
  • 27
  • 36
10
votes
2 answers

Named query not known

I have a mapping in NHibernate like this:
Vahid Ghadiri
  • 3,966
  • 7
  • 36
  • 45
10
votes
3 answers

Null value objects in NHibernate

I have a person entity containing an Address as a value object: public Person() { WithTable("Person"); Id(x => x.Id); Component
(x => x.Address, a => { a.Map(x => x.Address1); a.Map(x => x.Address2); …
James Allen
  • 6,406
  • 8
  • 50
  • 83
10
votes
3 answers

NHibernate.StaleStateException : Unexpected row count: 0; expected: 1

Hl Guys, I am busy writing a backend administrative program for a system that exists. I have selected NHibernate for my data access solution and am fairly new to it. I am experiencing the following error in a parent/child…
Tachi
  • 1,416
  • 4
  • 12
  • 15
10
votes
1 answer

Mapping multiple discriminator values to single default class in NHibernate

I have an existing RoleType table with data. I am trying to map this table in NHibernate using Table per class hierarchy:
Rohit Agarwal
  • 4,269
  • 3
  • 27
  • 22
10
votes
2 answers

How to persist a subset of an object instead of the whole object?

I'm struggling with a NHibernate related problem where I could use some input. Introduction: I have a legacy database where the relational concepts have not really been applied. In the database I have an OrderLine table which contains data for an…
JuniorCoder
  • 342
  • 1
  • 17
10
votes
1 answer

many-to-one with multiple columns

I have a legacy data base and a relation one-to-one between two tables. The thing is that relation uses two columns, not one. Is there some way to say in nhibernate that when getting a referenced entity it used two columns in join statement, not…
Sly
  • 15,046
  • 12
  • 60
  • 89
10
votes
1 answer

many-to-many mapping in NHibernate

I'm looking to create a many to many relationship using NHibernate. I'm not sure how to map these in the XML files. I have not created the classes yet, but they will just be basic…
10
votes
2 answers

How to map IDictionary in Fluent NHibernate

I have an class with an IDictionary on it.
Stu
  • 2,426
  • 2
  • 26
  • 42
10
votes
1 answer

DDD: Can a Value Object have lists inside them?

I'm not well versed in domain driven design and I've recently started created a domain model for a project. I still haven't decided on an ORM (though I will likely go with NHibernate) and I am currently trying to ensure that my Value Objects should…
10
votes
3 answers

Fluent NHibernate One-To-Many Mapping

I have the following 2 classes: Advert public virtual int Id { get; set; public virtual IList AdvertImages { get; set; } AdvertImage public virtual int Id { get; set; } public virtual string Filename { get; set; public virtual Advert…
9
votes
1 answer

Error in Cascade : deleted object would be re-saved by cascade

I have a project by NHibernate implementation and using Lazy Loading. I have two class in this project : Person and Family. Relation between Those two is aggregation, is mean a Person has a list of Person. Maping is :
Ehsan
  • 3,431
  • 8
  • 50
  • 70
9
votes
1 answer

FluentNHibernate mapping; Unable to map double or decimal with scale/precision

I'm working first time with FluentNHibernate, trying to map classes to SQL Express database. In general it works, but I'm unable to map Double or Decimal property types to specific scale/precision. Below shows result for a single property that I…
bretddog
  • 5,411
  • 11
  • 63
  • 111
9
votes
2 answers

NHibernate AssertException: Interceptor.OnPrepareStatement(SqlString) returned null or empty SqlString

I am trying to switch a table from being a many-to-one mapping to being many-to-many with an intermediate mapping table. However, when I switched it over and tried to do a query on it with NHibernate, it's giving me this error:…
jwynveen
  • 1,261
  • 3
  • 15
  • 34