nhibernate

why does hibernate not force you to mark fields as virtual, but nhibernate does?

why does hibernate not force you to mark fields as virtual, but nhibernate does? Is this a result of the differences between the VM and CLR? ...

How can I ensure that NHibernate creates a IList proxy?

I have a property on my domain object which is exposed as this: public virtual IEnumerable<WorkPost> WorkPosts { get { return sheetPosts; } private set { Guard.AssertAssignableFrom(value, typeof (IList<WorkPost>)); sheetPosts = value as IList<WorkPost>; } } The intern...

Duplicating child entities in Nhibernate 2.1?

I am migrating a project from NHibernate 1.2 to Nhibernate 2.1, and I have run into an odd error. NHibernate is loading duplicate copies of child entities into collection properties. Has anyone else run into this problem, and can you suggest a fix? Thanks for your help. Here are the problem details: My project is a simple Project Manage...

NHibernate exception collection [..User.Groups] was not processed by flush()

All of my NH entities derive from a type called BusinessEntity, it has the most basic values ID, Created, CreatedBy, Updated, UpdatedBy. CreatedBy / UpdatedBy takes a User I have a IPreUpdateEventListener and IPreInsertEventListener that fire to get the current DateTime for the audit values. Also in here I have my logic to get the curr...

C#/NHibernate: Association references unmapped class

I have been struggling with this NHibernate issue for hours. I extensively researched on the web as well as the NHibernate documentation, and I can make no sense of this issue. I'm relatively new to NHibernate, and love it. In that case, though, it's driving me mad. I'm writing a small "Poll" module for a website. I have several classes...

nhibernate: why does nhibernate update the foreign key of my child entity?

Ok, i have two entities named WorkPostSheet and WorkPost where the WorkPostSheet contains a collection of WorkPost-items: public class WorkPostSheet { ... public virtual IEnumerable<WorkPost> WorkPosts { get; private set; } } In my integration test, i notice that nhibernate creates an update statement ...

No persister for entity using AutoMap in Fluent Nhibernate?

I'm trying to utilise FluentNHibernate with Automapping but am receiving the following error No persister for: nHibernateSpike.Entities.Route NHibernate.MappingException: No persister for: nHibernateSpike.Entities.Route Here's the relevant stuff; var model = AutoMap.AssemblyOf<Route>(). Where(t => t.Namespac...

can i mix NHibernate updates with direct SQL in the same transaction

Hi, I'm wondering if it is possible to do direct SQL updates of my own in the same transaction as NHibernate is using to update my persistent objects? ...

using NHibernate on a table without a primary key

I am (hopefully) just about to start on my first NHibernate project and have come across a stumbling block. Would appreciate any advice. I am working on a project where my new code will run side-by-side with legacy code and I cannot change the data model at all. I have come across a situation where one of the main tables has no primary ...

How to refresh NHibernate cached data on WPF?

Hi guys, I have this WPF application using NHibernate and lazy data loading. I also use Microsoft Sync framework to sync data to and from a central database server. So what happens is that when I modify data on the central database server and sync it with the WPF client app, I can't get the latest data to be displayed to the UI since NHi...

Fluent nHibernate - unfriendly many-to-one reference name

I define my data model using Fluent nHibernate POCO classes + mappings. I'm also using nHiberate schema to create database schema. All is working fine but there is one unpleasent fact. When I use many-to-one reference referece is named by something similair to GUID instead of any descriptive name. Here's a piece of SQL: alter table [Odb...

Fluent; SessionSource or SessionFactory for creating sessions?

I'm using NHibernate + Fluent to handle the database in my application. So far I've been using a SessionSource to create my ISession objects. I'm a bit confused now about what comes from NHibernate or Fluent, and what I really should use for creating my sessions. ISession comes from NHibernate, and the SessionSource from Fluent. I crea...

nhibernate mapping many-to-many: why was the whole bag collections deleted and reinserted ?

Hello Nhibernate users, professionals, gurus and developers are expected. Please help !!! I want to realise a n:m relation between two classes. A student attends in more courses and a course consists of more students as members. I do a bidirectional association many-to-many with bag to get the both lists from each site. The two Studen...

Using the same classes for NHibernate and Script#?

I am about to start a project using NHibernate and Script# NHibernate required that all properties be virtual, so I have my entity like this: public partial class User { public virtual string Username { get; set; } public virtual string PasswordHash { get; set; } public virtual DateTime DateRegistered { get; set; } } But...

Set Accessor on class does not appear to work with TextInfo and TitleCase

Whilst playing around with an nhibernate mapping, I noticed that a property setter I had was being overloaded (or ignored). This is expected default behaviour with an nhibernate mapping. So I changed it to use the field.camelCase - so NHibernate would set the private field of the entity class and not the propety getter/setter so I could...

Memcached Provider for NHibernate not working

I've been at this for days. I have configure my web/app config to use the second level cache with a Memcached server and the provider from NHContrib. I don't get any exceptions yet in testing I see that it does not use the cache for my queries that I have set cacheable = true. If I switch the provider to the NHibernate.Cache.HashtableCac...

Synchronizing NHibernate Session with database - the reverse way

Hello I am using NHibernate for a project, and I am absolutely beginner. I am fetching some objects from a table and showing it to a form, where they can be edited. If an user inserts a new object into the table from some other window, I want to show this newly inserted object into the edit window. My application uses tabbed window inte...

NHibernate - Has Many Through

Is it possible to map a collection in Hibernate the same way that "HasMany :through" associations work in Ruby on Rails? ...

Nhibernate Inserting when should be update after adding Event Listener

I have a Custom EventListener hooked into listen for SaveOrUpdates and now whenever I call Session.SaveOrUpdate on my object it inserts when it should update. Here is my Event Listener: public class CustomSaveEventListener : DefaultSaveEventListener { protected override object PerformSaveOrUpdate(SaveOrUpdateEvent @event) { ...

NHibernate.Linq System.Nullable throws ArgumentException, the value "" is not type ...

I have a class of type MetadataRecord: public class MetadataRecord { public virtual long? IntegerObject { get; set; } public virtual string ClassName { get; set; } public virtual DateTime? DateObject { get; set; } public virtual double? DecimalObject { get; set; } public virtual long MetadataId { get; set; } publ...