Questions tagged [nhibernate-3]

Use this tag for Nhibernate version 3.x series specific question.

NHibernate is a mature, open source object-relational mapper (ORM) for the .NET framework. This tag refers to the 3.x series of this project.

86 questions
11
votes
2 answers

NHibernate 3.2 many to many mapping by code

I'm trying to learn NHibernate 3.2 built-in mapping by code api (NOT FluentNHibernate, nor xml). Can you help me to map a many-to-many relationship between these entities please? public class Post { public virtual Id { get; set; } public…
11
votes
2 answers

Serialize nhibernate entity to json error: Cannot serialize a Session while connected

I'm trying to serialize an nhibernate entity in to json but I always get this error saying Cannot serialize a Session while connected? Does it has something to do with nhibernate proxy?
ryudice
  • 36,476
  • 32
  • 115
  • 163
8
votes
2 answers

Eager load while using Linq in NHibernate 3

I need help with eager loading in with Linq in NHibernate 3 trunk version. I have a many-to-many relationship like this: public class Post { public int Id {get;set;} public IList Tags { get;set;} . . . } Now I have the…
madaboutcode
  • 2,137
  • 1
  • 16
  • 23
8
votes
1 answer

Join multiple tables with NHibernate and QueryOver

I have this tables: Person -> PersonFavorites, PersonCompany PersonCompany -> Company I have now to do the following select with NHibernate and QueryOver: select * from Person inner join PersonFavorites on Person.Id = PersonFavorites.PersonId …
BennoDual
  • 5,865
  • 15
  • 67
  • 153
7
votes
1 answer

How to do a conditional Sum with Nhibernate?

I'm trying to do the equivalent of this SQL Code SELECT ID SUM(CASE WHEN myProperty = 2 THEN 1 ELSE 0 END) as nbRowWithValueOf2, SUM(CASE WHEN myProperty = 3 THEN 1 ELSE 0 END) as nbRowWithValueOf3 FROM Foo GROUP BY ID With Nhibernate. So far I…
remi bourgarel
  • 9,231
  • 4
  • 40
  • 73
7
votes
1 answer

NHibernate Current Session Context Problem

I've recently moved from using an ISession directly to a wrapped ISession, Unit-of-Work type pattern. I used to test this using SQL Lite (in-memory). I've got a simple helper class that configures my SessionFactory, created an ISession and then…
BenCr
  • 5,991
  • 5
  • 44
  • 68
7
votes
2 answers

How to use nhibernate ToFuture query with nhibernte linq

Does ToFuture works with nhibernate linq? If so, how do you use it?
ryudice
  • 36,476
  • 32
  • 115
  • 163
7
votes
4 answers

NHibernate + WCF + Windows Service and WcfOperationSessionContext class

I have a Windows Service Application in which i create WCF services in it. One of the services is data services: add, delete, read , updatte data via WCF. WCF use NHibernate for data manipulation So my guestions are: Any advice (best practice)…
NoviceAndNovice
  • 705
  • 2
  • 13
  • 21
7
votes
4 answers

NHibernate 3.0: TransactionScope and Auto-Flushing

In NHibernate 3.0, FlushMode.Auto does not work when running under an ambient transaction only (that is, without starting an NHibernate transaction). Should it? using (TransactionScope scope = new TransactionScope()) { ISession session =…
6
votes
1 answer

What is the difference between ISession.SaveOrUpdateCopy() and ISession.Merge()?

In NHibernate 3.1, ISession.SaveOrUpdateCopy() has been marked as deprecated. The documentation suggests using Merge() instead. The documentation for each is as follows: SaveOrUpdateCopy(object obj) Copy the state of the given object onto the…
Brant Bobby
  • 14,956
  • 14
  • 78
  • 115
5
votes
3 answers

Breaking changes with NHibernate 4 upgrade

I can see what's new and fixed in NHibernate 4.0 I would like to know if anyone has had issue with hbm mappings upgrading from NHibernate 3 to 4? I fear that more focus is going on fluent mapping these days. I can test for the more obvious breaking…
dove
  • 20,469
  • 14
  • 82
  • 108
5
votes
3 answers

Fluent NHibernate - IndexOutOfRange

I've read all the posts and know that IndexOutOfRange usually happens because a column is being referenced twice. But I don't see how that's happening based on my mappings. With SHOW_SQL true in the config, I see an Insert into the Events table and…
4
votes
1 answer

In Linq-to-Nhibernate, has anyone managed to use .Contains in a where clause and also NHibernate.Linq.ToFuture() in the same query? (NH 3.x)

I always get a "System.Collections.Generic.KeyNotFoundException" that says "The given key was not present in the dictionary" whenever I try to use .Contains and the ToFuture() method in one query. Imagine the DBObject contains a bunch of properties…
Isaac Bolinger
  • 7,328
  • 11
  • 52
  • 90
4
votes
1 answer

Programmatically set Nhibernate to lower logging level for log4net

I have an application which logs to log4net but also uses Nhibernate. My app configures both Nhibernate (using Fluent Nhibernate config) and log4Net (using BasicConfigurator) programmatically . Problem is my logs are full of Nhibernate log info…
Richard
  • 21,728
  • 13
  • 62
  • 101
4
votes
1 answer

NHibernate 3: is it worth migrating?

We are using Nhibernate 1.2 on a big .NET 3.5 C# project and we are considering upgrading to Nhibernate 3.1. But I'm a little puzzled as I don't find over the Internet much articles dealing with improvements of the new versions (2.0 ->…
Francois
  • 10,730
  • 7
  • 47
  • 80
1
2 3 4 5 6