Questions tagged [nhibernate]

NHibernate is an open source object-relational mapper (ORM) for the .NET framework.

NHibernate is an open source object-relational mapper (ORM) for the .NET framework.

It started as a .NET port of the popular Java ORM Hibernate.

Installation

Installing NHibernate can most easily be done using its NuGet package:

Install-Package NHibernate 

Resources

17517 questions
5
votes
2 answers

NHibernate: Mapping a single column twice

Is it possible to map one column twice using NHibernate? I need to have the raw ID in order to bind…
falstaff
  • 3,413
  • 2
  • 25
  • 26
5
votes
1 answer

NHibernate Error - "could not initialize a collection"

I have many-to-one mappings working fine, but a one-to-many relationship between locations and location_times keeps giving me an error. I keep getting this error: on this line of code: Mappings look like this: Location: public virtual…
Positonic
  • 9,151
  • 14
  • 57
  • 84
5
votes
2 answers

The LastResultOperator result operator is not current supported

I have a query using linq to NHibernate, for EnterAndExitArchive entity. This entity has a association by Archive entity. public EnterAndExitArchive GetLastEnterAndExitArchive(long archiveId) { var q =…
Ehsan
  • 3,431
  • 8
  • 50
  • 70
5
votes
1 answer

NuGet: NHibernate, Castle.Core 3.0 and where is ProxyFactoryFactory?

I installed with NuGet the packages NHibernate and Castle.Core 3.0 for a new project. Usually we copied around the dlls manually; it is the first time I do that with NuGet. Now I can't find out how to configure the ProxyFactoryFactory, or let's say,…
sl3dg3
  • 5,026
  • 12
  • 50
  • 74
5
votes
2 answers

NHibernate Interceptor Auditing Inserted Object Id

I am using NHibernate interceptors to log information about Updates/Inserts/Deletes to my various entities. Included in the information logged is the Entity Type and the Unique Id of the entity modified. The unique Id is marked as a
TonE
  • 2,975
  • 5
  • 30
  • 50
5
votes
3 answers

NHibernate.Exceptions.GenericADOException : could not execute query

I have a legacy application (vfp 8) that I need to pull data from (no inserts). I am using the Accnum field as the primary key, it is defined in the table as character 11. Factory configuration:
CarbonMan
  • 4,350
  • 12
  • 54
  • 75
5
votes
1 answer

NHibernate & WCF: Performance (session reuse) vs. concurrency (simultaneous requests)

We are working on different integrations to a swarm of identically structured legacy databases that basically cannot be altered. For this, we added an auxiliary database for holding things like meta-information, routing rules and for temporarily…
5
votes
2 answers

Repository Pattern with NHibernate?

I am wondering how much should my service layer know of my repository? In past project I always returned lists and had a method for each thing I needed. So if I needed to return all rows that had an Id of 5 that would be a method. I do have generic…
chobo2
  • 83,322
  • 195
  • 530
  • 832
5
votes
2 answers

NHibernate - NHibernate.Exceptions.GenericADOException: could not execute query

I have the following exception occurring seemingly at random: NHibernate.Exceptions.GenericADOException: could not execute query [ select businesspr0_.BusinessProcessID as col_0_0_, businesspr0_.ProcessNumber as col_1_0_, businesspr1_.Name…
makcro
  • 195
  • 1
  • 3
  • 11
5
votes
1 answer

How to use case and order by in Nhibernate?

I need to order result in DB table ChargeOperations in my own direction by typeId. The SQL request is like this: SELECT * FROM ChargeOperations co LEFT JOIN ShadowChargeOperations sco ON sco.ChargeOperationId=co.Id -- just exclude some extra…
Artem A
  • 2,154
  • 2
  • 23
  • 30
5
votes
4 answers

NHibernate multiple primary keys mapping

I have a table called "Orderrow". Orderrow has a a compound primary key (CPK) with the following columns: OrderId, ProductId, RowNumber OrderId and ProductId are also foreign keys refering to the tables Order and Product. The RowNumber is generated…
Patrick Peters
  • 9,456
  • 7
  • 57
  • 106
5
votes
5 answers

FluentNhibernate and SQLite

I can't get SQLite Driver working in my sessionfactory. I downloaded SQLite 1.0.48 from http://sqlite.phxsoftware.com/ I have added the references to System.Data.SQLite in my Tests project. public static IPersistenceConfigurer…
5
votes
2 answers

Unable to cast object of type 'NHibernate.Hql.Ast.HqlCast' to type 'NHibernate.Hql.Ast.HqlBooleanExpression

I'm using the following c# code: public IList GetAllByExpression(Expression> expression, int startIndex, int count, Func dateTimeSelector) { using (ISession session = NHibernateHelper.GetSession()) { …
Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
5
votes
1 answer

How to write mappings for a stored procedure

There is an excellent post on how to map return values for a stored procedure call here: http://elegantcode.com/2008/11/23/populating-entities-from-stored-procedures-with-nhibernate/ The mapping in this example has been done through hbm files. I am…
5
votes
1 answer

Version does not increment when updating child item

If I read the documentation correctly if I have an Order entity mapped with a version column (incremented by nhibernate) then changes to orderlines should update the version number for the aggregate root (the Order). It does indeed do this when I…
Torkel
  • 3,364
  • 20
  • 16