nhibernate

Fluent Nhibernate, Subclass, ManyToMany. An association from the table refers to an unmapped class

I'm using Fluent(1.1.0) NHibernate(2.1.2) and I've got a (sub)subclass with a many-to-many reference to another class: (Sub)Sub Class --< Cross Table >-- Other Class or FloorplanObject (base class) Geometry (Subclass) Stand (SubSubclass) --< ExhibitorStand >-- Exhibitor Base Class: public class FloorplanObject { public int Id ...

XPO or NHibernate

Cześć, stoję właśnie przed wyborem ORM'a. I waham się: XPO czy NHibernate? Masz jakieś konkretne doświadczenia, którymi chciałbyś się ze mną podzielić? Będę wdzięczna za wszelkie info. Pozdrawiam, Ola :) [email protected] Hallo, I founded that you are familliar with these 2 ORM's : XPO (DevExpress) and NHibernate. What is your ...

Mapping a one-way ManyToMany?

I want to map the following company to the below address. I want it to be a one way relationship since the address class is being used by several other classes. When I generate the schema the junction table is created successfully but when I try to save an entity nothing is persisted in the junction table. Only in address and company ta...

Nhibernate mapping issue: a property whose type is a superclass

I have an NHibernate object that is a superclass (let's call it "Super"), and a subclass that inherits from it (let's say it's called "Sub"). <class name="Super" table="SuperThings"> <id name="Id" type="System.Int32" column="SuperId"> <generator class="identity" /> </id> <joined-subclass name="Sub" table="SubThings...

nhibernate hydration performance

Context: Domain model of Documents having Editions and Tags. What kind of figures are you going to expect when hydrating using nHibernate? My domain model not very complex and when I query all Documents fetching Editions as well as Tags the query returns a little more than 8000 rows from the database - which in turn are hydrated into a...

Lucene.Net and Nhibernate.Search: how to manage complex searches?

We have a SQL Server database with a million-ish records that are indexed by Lucene.net through Nhibernate.Search. When we built the index for our classes, we tried to be extensive since the cost for indexing/retrieval was really small. The goal was to offer full-text searching to users on a webpage with pagination. Since SQL Server com...

How to determine if an NHibernate entity was updated

I have an application that mass-updated a load of entities based on external data. Some of them will have not changed. NHibernate is clever enough to know whether the entity has changed and whether or not to send an update when I call DbContext.CommitChanges(). But I want to be able to output to screen/log when an entity has been update...

NHibernate criteria fetchmode

I have a type Type1 with a property Type2s consisting of a List<Type2>. I have configured the NHibernate mapping for the property as follows: [Map(0, Table = "Type2s", Schema = "MySchema", Cascade = CascadeStyle.All, Lazy = true, Inverse = true)] [Key(1, Column = "Type1Id")] [OneToMany(2, Class = "Type2, MyNamespace")] What is the dif...

Getting an index was out of range exception with NHibernate

Hi all, I'm currently building a web application with MVC and NHibernate. Now when i want to get information out of the database I get an index was out of range exception. The current situation is as follows. I got the mapping files of three database tables: A table to store a group with a one-to-many relationship with subscriberingro...

Why does GetGenericTypeDefinition fail?

I have a piece of code which needs to check an entity when being saved by my Repository. I have an NHibernate interceptor on the save to check this but when I call the GetGenericTypeDefinition function the code fails with the error: [InvalidOperationException: Operation is not valid due to the current state of the object.] System.Run...

Injecting a service into an implementation of NHibernate's IUserType using Autofac.

I'm using NHibernate to map the following class to an Oracle database in my ASP.NET MVC application: public class User { // Needs to be encrypted/decrypted when persisting public virtual string Question { get; set; } } Following several examples that I've found, I would like to use an implementation of NHibernate's IUserType t...

(Fluent) NHibernate: force foreign key to null on delete

I have a standard parent - child (1:many) relationalship, configured using Fluent NHibernate: On the parent side: HasMany(x => x.Items).Inverse().Cascade.All(); and on the child side: Map(x => x.ItemCategory).Nullable().Index("idx_item_category").Not.LazyLoad() (Edit in response to epitka's comment:) The record is deleted by call...

Does the NHibernate Query Analyzer work when targeting dlls that are built using .NET 4.0?

Is there a version of the NH Query Analyzer out there that can handle .NET 4.0 built dlls? ...

Expected System.String, got System.Guid

I am hoping there is a very simple explanation why I am getting this error. I am using S#arpArcitecture 1.6. on a 64bit Windows 7 install. Line 3 of the following code gives the error: {"Provided id of the wrong type. Expected: System.String, got System.Guid"} System.Exception {NHibernate.TypeMismatchException} 1 public Category G...

Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle'

Well, As I read and try every topic similar without success, I decided to post my own question. My solution has a console app and a class library for dataaccess. The Nhibernate configuration is inside the appconfig in the console app (which I'm currently using for debug, as I will after make a Web App and migrate all configuration to we...

Can NHibernate set non-public properties?

Is it possible to setup NHibernate to load/persist a non-public property of a class? For example I may have an Item class as follows. public class Item { public int ItemID {get; set;} public string Name{get; set;} } With the following mapping: <class name="RCL.Item" table="Items"> <id name="ItemID" type="Int32" column="It...

Manually managing a join table in Castle ActiveRecord

I have two connected classes defined like this: [ActiveRecord] public class Store : ActiveRecordBase<Store> { [PrimaryKey] public int ID { get; set; } [HasAndBelongsToMany(Table = "StoreCustJoin", ColumnKey = "storeID", ColumnRef = "customerID")] ...

NHibernate combining two database tables into one object

Hello all, I am using FluentNhibernate and i have a question about is. Is it possible two combine data from to different database tables into on entity? I have to work with an access database and an mssql datatbase and to work with both i think it is easier to combine. For example Db table 1 - name - address - email Db table 2 - ...

NH Linq with FetchMany and ToFutureValue in NH 3.0.0beta

I'm trying to use the ToFuture with the new NH Linq 3.0 provider. This works fine: var result = ses.Query<Parent>() .Where(x => x.Id == id) .ToFutureValue(); but when I use a Fetch/FetchMany like this: var result = ses.Query<Parent>() .Where(x => x.Id == id) .Fetch(x =...

nHibernate, an n-Tier solution + request for advice

I'm getting the chance to develop a mildly complex project and have been investigating the various approaches that I can use to tackle this project. Typically I would have ran with the traditional 3-Tier approach but after spending some time looking around at various options I've got an inkling that some kind of ORM might be a better fi...