nhibernate

Nhibernate C# - Return only objects where string property is not null or empty.

I'm writing a query using ICriteria that should return only the objects where property "Message" has value (i.e. is not null or empty). Below is the format I'm using. ICriteria.Add(Restrictions.Not(Restrictions.Eq("Message", " ")); ICriteria.Add(Restrictions.Not(Restrictions.Eq("Message", String.Empty)); Can somebody help me with this...

Deleted object would be re-saved by cascade

What I have is this: Domain.List has many ListToListMemberships called "SubLists" Domain.List also has many ListToListMemberships called "ParentLists" ListToListMembership has one List (the parent). ListToListMembership has another List (the member). Given this I want the following test to pass: [Test] public void WhenDeleti...

NHibernate Interceptor Not Used When Saving

I have a NHibernate Interceptor that is set in the HibernateTemplate using Spring.Net (I'm using ASP.NET MVC, fwiw), which is used for Auditing. However, for some reason, while the OnLoad method is being triggered when I call genericDAO.Get(id), when I try to save something using genericDAO.SaveOrUpdate(object) neither the OnSave or OnFl...

NHibernate with informix database "IBM IDS"

Hi All, which NHibernate driver can i use with informix database "IBM Informix Dynamic Server" ? Thanks, Amjad. ...

Application configuration table, only one row

I am going to have a application configuration table, something like this. public virtual int id { get; set; } public virtual bool CommentsActive { get; set; } public virtual bool UploadByPublicUser { get; set; } public virtual bool UploadPicturesByPublicUser { get; set; } Now this table only gone have one row and it's...

NHibernate - flush before querying?

I have a repository class that uses an NHibernate session to persist objects to the database. By default, the repository doesn't use an explicit transaction - that's up to the caller to manage. I have the following unit test to test my NHibernate plumbing: [Test] public void NHibernate_BaseRepositoryProvidesRequiredMethods() { ...

NHibernate.Search Index Rebuild

Hi, How can i rebuild Lucene.NET Index using NHibernate.Search ? Thanks. ...

NHibernate.Search Projections

How-to use NHibernate.Search Projections ? ...

Is there an NHibernate killer out there?

This is probably a long shot. In the .NET world, has anyone found an ORM (Commercial or Open) that has the flexibility of NHibernate to support domain driven design with good Linq support? Linq to sql is dead, Entity Framework doesnt yet support POCO's, lazy load or object first development very well, and none of the old stand bys such...

FluentNHibernate: Nested components in a One to Many relationship

I can have a nested component on a one to one like this: Component(a => a.XPTO, m => { m.Map(xpto => xpto.X, "X").Not.Nullable(); m.Component(xpto => xpto.Y, m2 => { m2.Map(y=...

Linq to Nhibernate Bulk Update Query Equivelent?

Hi, Not sure if I'm missing anything here. Basically, I am looking for Linq to Nhibernate to do the following SQL statement: update SomeTable set SomeInteger = (SomeInteger + 1) where SomeInteger > @NotSoMagicNumber Is there any way to do that? Thanks! ...

Assigned id usages in Nhibernate (ORM’s)

Why are assigned id’s frowned upon in the Nhibernate world? Is there a particular disadvantage to using it? ...

Fluent NHibernate SetBatchSize method

I'm using NHibernate Profiler to see if batching really occurs. Code looks like this Session.NHibernateSession.SetBatchSize(data.Items.Count); foreach (var o in data.Items) { //something else... base.Save(o); } Session.NHibernateSession.SetBatchSize(0); Profiler still gives me error "Large number...

NHibernate - map a collection from a custom SQL Query?

Hi, I'd like NHibernate to fill a collection on my class from a custom query. My setup is somewhat like this: Class A has a one-to-many relation to Class B. B has two many-to-one relationships to Class C, From and To. In Class B, I want to be able to map a collection of C instances, based on the From and To relations. The collection s...

FluentNhibernate HasMany with component

i have this mapping: HasMany<ClassA>(ot => ot.AList) .Table("XPTO") .KeyColumn("IDXPTO") .Component(m => { m.Map(a=> a.X, "X"); m.Map(x=> x.Y, "Y"); }) .Cascade.AllDeleteOrphan(); i get an error ...

Why Fluent NHibernate vs. hbm XML files?

While this is a subjective question, as a new NHibernate user, I'm curious as to why one would choose Fluent vs traditional XML mapping. From my standpoint, when I first worked with NHibernate, I used the Fluent interface, but ran into some roadblocks and had a hard time finding adequate documentation for the Fluent interface for anythi...

Fluent-NHibernate : how to map one-to-many relationship into 3 tables (many-to-many, kinda)

I have to 2 entities like this: class A { int id { get; set; } string Name { get; set; } } class B { int id { get; set; } A RefToA { get; set; } string Name { get; set; } } How can I map this 2 classes so that i would have 3 tables like this: table A with 2 columns: id and name table B with 2 columns: id and name t...

NHibernate CreateSqlQuery and object graph

Hello I'm a newbie to NHibernate. I'd like to make one sql query to the database using joins to my three tables. I have an Application with many Roles with many Users. I'm trying to get NHibernate to properly form the object graph starting with the Application object. For example, if I have 10 application records, I want 10 applicati...

NHibernate Session DI from StructureMap in components

I know this is somewhat of a dead horse, but I'm not finding a satisfactory answer. First let me say, I am NOT dealing with a web app, otherwise managing NH Session is quite simple. I have a bunch of enterprise components. Those components have their own service layer that will act on multiple repositories. For example: Claim Compo...

Informix, NHibernate, TransactionScope interaction difficulties

I have a small program that is trying to wrap an NHibernate insert into an Informix database in a TransactionScope object using the Informix .NET Provider. I am getting the error specified below. The code without the TransactionScope object works -- including when the insert is wrapped in an NHibernate session transaction. Any ideas on w...