nhibernate

nhibernate query with child entities and lazy="false"

Hi All I have a problem with seperate sql queries being generated for every item in a child collection when selecting the Parent. I have a Parent object with an IList collection of Child objects. If I run the following code using linq to nhibernate: IList parents = _repository.ToList(); I get the sql statements like the following: S...

Share first level cache between different sessions?

Is it possible for different NHibernate sessions to share one 1st level cache? I`ve tried to implement it using interceptors and listeners. All works fine except Session.Evict(). public class SharedCache : EmptyInterceptor, IFlushEntityEventListener, ILoadEventListener, IEvictEventListener, ISharedCache { [Thread...

"Session is Closed!" - NHibernate

This is in a web application environment: An initial request is able to successfully complete, however any additional requests return a "Session is Closed" response from the NHibernate framework. I'm using a HttpModule approach with the following code: public class MyHttpModule : IHttpModule { public void Init(HttpApplication conte...

When I set NHibernate "adonet.batch_size" the sql not logged any more.

When I set both: show_sql = true adonet.batch_size = 100 the INSERT/UPDATE SQL statements are not logged any more. Can this be fixed some how? ...

Real world complex example of Nhibernate

The project on which i am working has a very complex business and data logic. I have around 90 tables and 250 stored procedures in my database. I have seen very basic samples on Nhibernate through which the operations are performed on database. I just want to know if we have a huge complex logic then how can we use nhibernate. Also cu...

NhibernateDataSourceControl

Anybody out there that has used this control in production, and has anybody broken dependency on Spring.Core? http://www.codeproject.com/KB/aspnet/NHibernateDataSource.aspx ...

NHibernate version confusion

OK, hit me over the head if this is a blatantly duplicate question.... I recently purchased NHibernatie in Action from Manning. This book outlines version 1.21 It mentions a version 2.0 of NHibernate that is coming/is in beta. If I download NHibernate from nhforge I get version 2.1 Is the book hopelessly outdated?? ...

NHibernate not picking up changes

I am wondering under what circumstances the following NHibernate code could fail: var session = NHibernateSessionManager.CurrentSession; var foo = session.Linq<Foo>.ToList()[0]; foo.SomeProperty = "test"; session.SaveOrUpdate(foo); var reloadedFoos = session.Linq<Foo> .Where(x => x.SomeProperty == "test"); ...

PostgreSQL with NHibernate problem with LIKE and parameter.

I have a problem with PostgeSQL and NHibernate. I have tried HQL and Criteria and select returns nothing. I used log4net to get generated query, replaced parameters with value and query returns result, why is that? Is there a special configuration for Postgre or NHibernate? I even tried with lowering (lower(column) like lower(:param)) an...

NHibernate - New Item added to Collection is not persisting

I have a Client Table with One to Many relationship with Contact Persons. I've mapped the two classes for NHibernate as In Client Class <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MyAssembly.Core" namespace="MyAssembly.Core.Domain" > <class name="Client" table="CompanyXClie...

Fluent nHibernate: one-to-many relationship problem

I have a problem with one-to-many relationships. I have the following domain classes: public class Installation : Entity<Installation> { public virtual string Name { get; set; } public virtual IList<Institution> Institutions { get; set; } public Installation() { Institutions = new List<Institution>(); ...

Searching on multiple columns in NHibernate

How would one do the following in NHibernate? SELECT ContactName, ContactTel1, ContactTel2, ContactTel3 FROM tb_Contact WHERE (ContactTel1 LIKE '%6440%') OR (ContactTel2 LIKE '%6440%') OR (ContactTel3 LIKE '%6440%') This is what I have, but can't figure out how to do the same with multiple columns. al...

NHibernate Linq Like Query Question

Is there any way to make NHibernate.Linq generate a like query on an integer field? The SQL that I want it to generate is: select IntegerColumn from Table where IntegerColumn like '%StringValue%' I've tried something like: from entity in _session.Linq<Entity> where entity.IntegerColumn.ToString().Contains(StringValue) select enti...

Fluent NHibernate: foreign key not null problem

I have the following domain classes: public class Installation : Entity<Installation> { public virtual string Name { get; set; } public virtual IList<Institution> Institutions { get; set; } public Installation() { Institutions = new List<Institution>(); } } public class Institution : Entity { pub...

nhibernate criteria queries

Hello is it possible to record sql queries being generated by nhibernate criteria ?, i have a disconnected scenario where i can use these query hashes as keys to cache result sets on client. many thanks ...

How to find a dependency on the assembly

I have a solution with about 10 projects, and I recently upgraded to new version on NHibernate, yet when I run solution and get the message: "The located assembly's manifest definition does not match the assembly reference". So some component is looking for old version. I tried removing all references in my project to NH, and re-adding t...

NHibernate cache is not saved

Hello I got a problem with NHibernate. The problem is that whenever I update a bag collection on the parent object. The bag is not updated. The cache contains the data but it is not saved to the database. I have tried UnitOfWord.Current.Flush() without any result. Can anyone please help me? ...

NHibernate: "failed to lazily initialize...", DDD approach

Hello, I'm trying to set up NHibernate in an ASP.NET MVC application using a DDD approach. However, I do get an error when trying to lazy load an objects related entity. Heres how I've structured my application: Infrastructure layer: Contains mapping files, repository implementations and a NHibernate bootstrapper to configure and build...

Sequential numbers in distributed word

We are building order processing system. We have a cluster of processing servers. We need to assign readable numbers to the orders (e.g. ORD-000001, ORD-000002). Main problem that this is hard for us to implement system wide lock. I am thinking about schemas with lock expiration. But everything comes in mind still have bottlenecks. We...

SchemaExport with FluentNhibernate

Is there anything wrong with this code. I am not getting anything generated and no exceptions are thrown. public static void ExportSchema() { Configuration cfg = LoadDefaultConfiguration(); Fluently.Configure(cfg) .Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.Load("dnnSphere.M...