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

NHibernate generic dictionary table mapping

I've got one table for all my dictionaries: "Id, TypeId, Value" and so for particular TypeId I've got pair: "Id + Value" which is my concrete dictionary. How do I should map it? At the moment I can imagine that I'll have an abstract class…
Roman Motyka
  • 649
  • 1
  • 6
  • 15
0
votes
1 answer

NHibernate Composite Index, not a key

Still a n00b in NHibernate :( I want to add a composite index to the hbm.xml of one of my POCOs, for performance purposes. It does not relate directly to a class, but rather two common values I will be querying against. I think I need to do a…
Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254
0
votes
2 answers

Retrieving data from PostgreSQL database using SharpLite

The problem is that my MVC app is connecting well to my database but when I query it it doesn't return anything(var model is empty) and I don't know what's the problem.I'm using SharpLite template so this already has automappings implemented and is…
0
votes
2 answers

Is it possible to distribute NHibernate-by-Code-Mappings over several classes?

Is it possible to distribute a NHibernate-by-Code-Mapping over several classes? E.g. public class EntityMap1 : ClassMapping { Id(x => x.Id); Property(x => x.PropertyOne); } public class EntityMap2 : ClassMapping { Property(x…
Test
  • 3
  • 3
0
votes
1 answer

Mapping Entities for nHIbernate Fluenty

I'm having a bit of an problem wrapping my head around the task at hand or more so the best way to do it that is. Take a sample project: UI DATA (Assembly) SERVICE (Assemblies) built onto DATA Do I put all mappings in the DATA assembly or should I…
Anthony
  • 441
  • 1
  • 5
  • 20
0
votes
3 answers

NHibernate half mapping one directional?

I can't really articulate what I want in the title very well but essentially is this possible? public class Employee { public Address address; ... public class address { ... Very simple object model, an Employee that has an Address object…
David
  • 1,731
  • 24
  • 37
0
votes
1 answer

NHibernate - IUserType For Changing Type?

My application has the following classes: public class Widget { public virtual int Id { get; set; } public virtual WidgetType Type { get; set; } public virtual string Parameters { get; set; } } public class WidgetType { …
nfplee
  • 7,643
  • 12
  • 63
  • 124
0
votes
1 answer

How to Map Enum in NHibernate to Properly Create DB Field on Schema Export?

I've seen several questions related to properly mapping an enum type using NHibernate. This article by Jeff Palermo showed me how to do that properly by creating a custom type. I use Schema Export to create my DB during my dev cycles, but this…
Mark Struzinski
  • 32,945
  • 35
  • 107
  • 137
0
votes
1 answer

NHibernate Criteria API error with create alias and a collection of projections

I'm tasked with generating a list of member data using the NHibernate Criteria API. I need to incorporate paging and filtering based on checkboxes in the UI. What makes this a bit more complex is that I'm not just fetching data from one entity, but…
0
votes
1 answer

Mapping SQL Views with NHibernate and Foreign Keys

In my Solution I have the following projects MySystem.Core MySystem.Core.Data MySystem.MyAudit1.Core MySystem.MyAudit1.Core.Data MySystem.MyAudit2.Core MySystem.MyAudit2.Core.Data The number of audit projects could potentially grow to around…
Declan McNulty
  • 3,194
  • 6
  • 35
  • 54
0
votes
1 answer

Hibernate Invalid Mapping exception

I am using the latest jars for hibernate. (i.e. hibernate-release-4.0.1.Final ) In the previous versions i was getting proper output. I replaced the hibernate jars and there was a exception. org.hibernate.InvalidMappingException: Unable to read…
bali208
  • 2,257
  • 7
  • 40
  • 43
0
votes
1 answer

nhibernate generating incorrect sql query with weird alias

So I have An entity called VideoAsset that is mapped to a VideoCategory and Group. Both are many to many: public class VideoAssetMap : IAutoMappingOverride { public void Override(AutoMapping mapping) { …
Ben
  • 1,853
  • 19
  • 20
0
votes
1 answer

fluent-nHinernate TriggerIdentity nhIdOutParam always return null (Oracle rdbms)

I using Oracle rdbms. My mapping looks like this Id(x => x.Tid,"ID").Column("ID").GeneratedBy.TriggerIdentity(); but the SQL request ends up looking like: NHibernate: INSERT INTO bla bla bla :nhIdOutParam = NULL [Type: Int32 (0)] Why does…
0
votes
1 answer

Fluent Nhibernate Many to Many association to multiple classes

Fluent Nhibernate Many to Many association to multiple classes We use Nhibernate and up to now we have been able use the auto mapping. But I think this is about to change. We have a Code class that has a many to many relation with several other…
k.c.
  • 1,755
  • 1
  • 29
  • 53
0
votes
1 answer

nHibernate code mapping for enum collection

I'm getting started with nHibernate code mapping and I'm stuck on mapping a collection of enums. (Note, this question is similar to Mapping collection of enum in NHibernate but different in that I want to map using code mappings.) I have an entity…
quip
  • 3,666
  • 3
  • 32
  • 45