nhibernate

"UPDATE failed because the following SET options have incorrect settings: 'ARITHABORT'

SaveOrUpdate using nHibernate is getting the following error. UPDATE failed because the following SET options have incorrect settings: 'ARITHABORT' If I set arithabort on: var command = session.Connection.CreateCommand(); command.CommandText = "Set Arithabort on"; command.ExecuteScalar(); Instead of getting the update failed, I ge...

NHibernate Rollback w/ broken rules (validation best practice)

I'm working on a legacy system that is using the enterprise library validation block to add a broken rule when an object is not valid. Then the user is returned a message based on this error and told the object was not updated. The only issue is that now I'm using NHibernate to persist these objects -NHProf shows an update to the obj...

Excluding some tables from Fluent Nhibernate schema Generation

I have some existing asp.net membership and roles tables in a legacy db and I am mapping them to new entities with Fluent Nhibernate. I also generate the schema directly from Fluent Nhibernate and I then manually tweak the generated sql script to exclude the existing tables. Is it possible to say to Fluent Nhibernate to exclude from ...

TooManyRowsAffectedException with encrypted triggers

I'm using nHibernate to update 2 columns in a table that has 3 encrypted triggers on it. The triggers are not owned by me and I can not make changes to them, so unfortunately I can't SET NOCOUNT ON inside of them. Is there another way to get around the TooManyRowsAffectedException that is thrown on commit? Update 1 So far only way I'...

Issues with Fluent Nhibernate Automapping in version 1.0RC

I am new to NHibernate and am running into some issues getting the Automap functionality to work properly. Here are a couple of issues I am having. The getting started wiki for Fluent NHibernate (http://wiki.fluentnhibernate.org/Getting_started) defines a sample with store, product, and employee classes--as well as the mapping for thos...

Inheritance and Associations in NHibernate

I have an entity model where the base class in an inheritance structure has an association with another class, and was wondering if the subtypes of the base class will have the association mapped up as well? For a bit more information, here is a basic outline of this part of the system: Transport is the base class, and has an associati...

NHibernate maps to base instead of subclass.

In my business model I have Entity class (IPoint interface) that has a list of child elements of the same type. The link in DB is made via many-to-many table. The Entity has also discriminator for subclassing (IPoint implementations). At first I made simple many-to-many mapping for this and all was working good. But then I've made (as b...

What's a good example domain for an NHibernate presentation?

I'm trying to put together a presentation for my local .NET user group on NHibernate. I want to demonstrate how one might convert an existing application's data access layer to use NHibernate, but first I need an application to convert. What would be a good example domain that would allow me to demonstrate the main features of the ORM...

How can you create Clustered Indexes with Fluent NHibernate?

I am using Fluent-NHibernate (with automapping) to generate my tables but would like to choose a different clustered index than the ID field which is used by default. How can you create clustered indexes with Fluent NHibernate on a field other than the default Primary Key field? The primary reasoning behind this is simple. I am using Gu...

NHibernate HiLo - one table for all entities

I'm using NHibernate HiLo as my identity generator. I currently have a sepperate table in my database for each of my entity tables. For example I have Customer and CustomerKey table, each with a NextHiLo column. What would be a great thing to have is a single table that holds key for all the others. Idealy would be if i could have a tab...

How to recompile Sharp Architecture library to use NHIbernate 2.1.0.4000 instead of 2.1.0.3001

I have updated the Sharp Architecture solution (SharpArchitecture_1.0_RTM_build_486) (my local copy) and referenced NHibernate 2.1.0.4000 instead of NHibernate 2.1.0.3001 dll. I have also updated all other NHibernate related references in Sharp Architecture solution. I was able to rebuild Sharp Architecture and to pass all the tests us...

Unique results from joined queries with NHibernate LINQ provider

I'm using NHibernate 2.1 with the LINQ provider and the results I get back from this query have multiple root nodes: public IList<Country> GetAllCountries() { List<Country> results = (from country in _session.Linq<Country>() from states in country.StateProvinces orderby country.Dis...

How to clear NHibernate second level cache

I'm using HashtableCacheProvider as NHibernate second level cache provider for my web application. The problem is that it seems that NHibernate keeps cached data even if I restart my IIS. I thought that cached data will disappear when in that case. Can someone explain how does this thing work, and how can I clear the second level cache w...

NHibernate Get Collection of object A based on aggregates roots id

Class A { Guid ID{get;} ISet<B> ClassBs {get;} } repository public IList<B> GetAsBs(A a) { ICriteria ACriteria = Session.CreateCriteria(typeof(A)); ICriteria BCriteria = ACriteria.CreateCriteria("ClassBs"); A.Add(Restrictions.Eq("ID", a.ID)); return BCriteria.List<B>(); } I can accomplish this in HQL np but want to use criteria i am ...

NHibernate: Creating a criteria which applies for all queries on a table

Using Castle ActiveRecord / NHibernate: Is there a way you can force an ICriterion on all queries on a table? For example, a good amount of of my tables have a "UserId" column. I might want to ensure that I am always selecting rows for the logged in user. I can easily create an ICriterion object, but I am forced to supply it for differe...

NHibernate and hbm2dll update attribute

Hi, i'm using NHibernate with Sdf database. In my hibernate.cfg.xml file i've set: <property name="hbm2ddl.auto" value="update"/> But this does not seem to work at all. "Update" attribute should make NHibernate generate missing tables and columns during application launch, but it does not happen. If i want missing tables geenrated I...

NHibernate Performance on an internet banking application

Currently we have a project to implement an Internet Banking site, and we are evaluating using Nhibernate on it. ¿Is NHibernate suitable for this kind of application, where performance is important and there will be a large quantity of users doing operations simultaneously? ¿Do you know any successfull stories of using NHibernate in th...

NHibernate, quickest possible primer

I moved away from typed DataSets and I (happily) never looked back. I am looking into NHibernate for persistence of my objects, and would like to see some text such as 'NHibernate for (DataSet) Dummies'. Some text that will assure me that I will be able to seamlessly update data islands, have possibilities of class inheritance, and so ...

Issue With Fluent Nhibernate Automapping and Guids / UniqueIdentifiers as Primary Key Fields

I am attempting to use the Fluent-NHibernate automapping functionality (in the latest version of the software) and am running into problems using Guids as the Primary Key fields. If I use integer fields for the primary keys, the tables are generated successfully and all Nhibernate functionality seems to work fine. FYI, I am using NHibern...

How do you map aggregate functions in NHibernate?

I'm new to NHibernate and trying to create my first mapping. I have created a class like this (my example is simplified): public class Buyer { public int BuyerID { get; set; } public string Name { get; set; } public decimal AverageOrderAmount { get; private set; } public DateTime LastOrderDate { get; private set; } } ...