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

could not create the driver from nhibernate.driver.sqlclientdriver, nhibernate, version=5.3.0.0, culture=neutral, publickeytoken=aa95f207798dfdb4

I faced the below error fluentNhibernate in .net 6 project but the same code is working in framework 4.8. Error: could not create the driver from nhibernate.driver.sqlclientdriver, nhibernate, version=5.3.0.0, culture=neutral,…
7
votes
2 answers

Why does NHibernate throw a "GenericADOException : could not initialize a collection" exception during ISession.Refresh in this case?

I've been been experiencing a weird behaviour (at least to me) with ISession.Refresh(). I've got an entity with a lazy-loaded collection of children, and a read-only property that hits this collection, all included inside the 2nd-level cache. I use…
Mathieu Garstecki
  • 1,589
  • 1
  • 13
  • 18
7
votes
3 answers

No persister for: Castle.Proxies.Proxy and lazy="true" in NHibernate?

I am trying to use lazy loading for a property of one of my entities The property mapping is something like this: However when I am tring to save an instance of this entities…
Louis Rhys
  • 34,517
  • 56
  • 153
  • 221
7
votes
2 answers

What is the difference between IWindsorContainer vs IUnityContainer?

I've worked with both 2 types of container between IWindsorContainer and IUnityContainer in different project for service and Interface binding. However I am not pretty sure what are the differences? Do they have same features? If yes then what is…
7
votes
3 answers

NHibernate mapping - one-to-one (or one-to-zero)

NHibernatians! I have a table [dbo].[Wibble] and another table [dbo].[WibbleExtended]. [Wibble] is the main table and [WibbleExtended] is an optional table where some other fields are stored. There are far fewer entries in the [WibbleExtended]…
Iain Holder
  • 14,172
  • 10
  • 66
  • 86
7
votes
2 answers

Class com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer has no default (no arg) constructor

I am getting an error - 'Class com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer has no default (no arg) constructor' while I am trying to call restangular for post request. When I call the method it goes in the error…
Geetanjali Jain
  • 402
  • 6
  • 19
7
votes
3 answers

Using a reference as id in fluentnhibernate

I have a child table containing an id to the parent. This is a one to one mapping, but the child table might be missing values. I'm having problems mapping this without getting an error though... I've tried several things; mapping the same column,…
simendsjo
  • 4,739
  • 2
  • 25
  • 53
7
votes
1 answer

Fluent NHibernate join not using primary key

I am trying to get a single property from a joined table where a non-PK in my main table is joined to the PK of the foreign table. Below is an oversimplified example of what I am trying to accomplish (I do not want to reference the foreign…
jwarzech
  • 6,596
  • 11
  • 52
  • 72
7
votes
2 answers

NHibernate MappingException: Could not compile the mapping document

On my dev web app NHibernate is working just dandy. When I precompile and deploy the site, I get a MappingException when the SessionFactory is created. Here's some info from the trace: NHibernate.Cfg.Environment 2010-07-15 09:20:59,577 [7] INFO…
David
  • 15,750
  • 22
  • 90
  • 150
7
votes
3 answers

Manually setting the ID

I have a Users table where the "ID" field is a GUID field. Using ASPNET I am creating a user account and getting the GUID back. I am trying to create associated records in my tables with that GUID as the main ID. The problem I am running into is…
7
votes
2 answers

Fluent NHibernate - how to map a subclass one-to-one?

Suppose I have three classes. It is valid to instantiate A, but there are also special cases B and D which subclass A, adding additional information. How would I do the mapping files for this in (fluent) NHibernate? public class A { public int…
Nathan
  • 10,593
  • 10
  • 63
  • 87
7
votes
3 answers

Fluent NHibernate Many to one mapping

I am new to Hibernate world. It may be a silly question, but I am not able to solve it. I am testing many to One relationship of tables and trying to insert record. I have a Department table and Employee table. Employee and Dept has many to One…
Jit
  • 135
  • 1
  • 2
  • 9
7
votes
2 answers

How to look up an NHibernate entity's table mapping from the type of the entity?

Once I've mapped my domain in NHibernate, how can I reverse lookup those mappings somewhere else in my code? Example: The entity Pony is mapped to a table named "AAZF1203" for some reason. (Stupid legacy database table names!) I want to find out…
snicker
  • 6,080
  • 6
  • 43
  • 49
7
votes
1 answer

Properly mapping a polymorphic relationship with NHibernate

I am trying to create a table-per-hierarchy mapping using NHibernate 2.0.1. I have a base class with properties that exist for each subclass that other classes inherit from. All of these objects are persisted to one table called Messages that…
CountCet
  • 4,545
  • 7
  • 30
  • 39
7
votes
4 answers

Nhibernate entity with multiple Many-To-Many lists of the same type?

Does anybody know how I would map an entity with two many-to-many collections of the same child type. My database structure is this.... The "normal" relationship will be.... tbl_Parent col_Parent_ID tbl_Parent_Child_Xref col_Parent_ID …
Rob Gibbens
  • 1,122
  • 1
  • 8
  • 24