nhibernate

ICriteria SetCacheable expiration time

Hello all. I want to know how make NHibernate store my queries at 2-nd level cache for specified time I see it only for entities cache. Thank you for replying. ...

Nhibernate fires SQL commands

Hi all, when updating an entity A, NHibernate also send an SQL update command for some other entity B. A and B are not related. Just before saving entity A, the parent of entity B is loaded via a SQLQuery. Then, when accessed, B is lazy loaded (part of a collection). If I save entity A an update statement for entity B is generated as we...

How to make Lucene.NET Query '#' and '+' characters ?

How to make Lucene.NET Query '#' and '+' characters ? Like "C#" and "C++" Note : i use NHibernate.Search ...

Fluent Nhibernate and Dynamic Table Name

Hi, I've got a parent and child object. Depending on a value in the parent object changes the table for the child object. So for example if the parent object had a reference "01" then it will look in the following table "Child01" whereas if the reference was "02" then it would look in the table "Child02". All the child tables are the sa...

NHibernate and parent/child collection mapping

Hi, I have this table containing both parent and child elements. CREATE TABLE Expenses( [BudgetId] int, [AccountGroupId] int, [AccountNumber] int, [Amount] decimal ) In my domain model it's represented by this hierachy: Budget AccountGroup ExpenseLine ExpenseLine ExpenseLine So a Budget has a collection of A...

What is the overhead of Castle Active Record?

What is the overhead of using Castle Active Record over using nHibernate directly in terms of performance? Is it significant or it does not matter? ...

Many to many as map in fluent Nhibernate

Is there a way to map a many-to-many relationship using Fluent NHibernate to a dictionary? Say I have the following (totally just made up) tables: Person ( Id INT, Name NVARCHAR(MAX) ) Address ( Id INT, StreetAddress NVARCHAR(MAX) ) PersonAddresses ( PersonId INT, AddressId INT, AddressType NVARCHAR(MAX...

nhibernate 2 books

Is there any hibernate 2 book? No v 1.x Thanks ...

How to add extra field in the ManyToMany generated table with FluentNHibernate

I have 2 entities Users and Colors. One user may be associated with multiple colors, and one color may be associated with multiple users. I use FluentNHibernate autopersistence model to generate the database. Now I have to add to the generated table UserToColor(UserId,ColorId) also an extra field 'CreatedOn', how can I accomplish and is...

NHibernate - Unexpeted update wihout explicit update

Hi, after a child collection with one item in it gets lazy loaded when performing an SQL select on the parent, an update statement is executed for this child afterwards - without explicitly calling update. Parent mapping: <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="ParentEntity" assembly="ParentEntity"> ...

Unexpected row count in Nhibernate when deleting parent records with associated child records

Hi, I have a parent table, Orders and a child table, [Order Details], I have setup the fluent mappings as - (In the parent Order class) HasMany<OrderDetails> (x => x.Details).KeyColumn("OrderId").Cascade.AllDeleteOrphan().Inverse(); (In the child [Order Details] class) References(x => x.ParentOrder).Column("OrderId").Not.Nullable(...

NHibernate - How to update sort order

I am trying to update several records with a database through NHibernate. The direct SQL query looks like: update records set sortOrder = sortOrder +1 where sortOrder >= 3 and sortOrder <= 100 Is this possible in NHibernate? I don't want to take the approach of pulling each record and updating them one at a time since this method can...

Lazy loading BelongsTo relation with Castle Active Record?

I have the following mapping for a Relation in Castle AR [BelongsTo("EVENT_ID", Lazy = FetchWhen.OnInvoke)] public EventType PayEvent { get { return m_PayEvent; } set { m_PayEvent = value; } } But the Relatio...

ReadUncommitted broken in SqlLite against NHibernate

I am using sqlite for test cases in a project that leverages NHibernate. Everything is working great, except when I try to create a ReadUncommitted transaction: e.g. Session.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted) The error message is: "isolationLevel" (thats it) The call stack looks like: at System.Data.S...

Fluent NHibernate automapper: skip an intermediate class w/ table-per-subclass

I'm using the Fluent NHibernate mapper with table-per-subclass to map the following structure: public abstract class A { // properties here } public abstract class B : A { // methods here } public class C : B { // properties here } My database only has tables to represent class A and class C. Class B exists only in my mo...

Implement own IsDirty in nHibernate

For my current project, we use a nHibernate session to retrieve the object, and another session to update the changes we've made to the object in between the two session. If we use SaveOrUpdate(), nHibernate will typically do a select-then-update (so, two calls to the database). However, our own business objects already keep track of ch...

Cannot use collections with InExpression

I've just delved into a bit of NHibernate and I'm having trouble with one of the more 'complex' (to me!) queries I have to write. The scenario is: I've got a 'Staff' object which has a collection of 'Skills' attached. I'd like to pass in a list of 'Skills' to query against (e.g. if I only want people that can either 'Cook' or 'Code', or...

Two different assembly versions "The located assembly's manifest definition does not match the assembly reference"

I have a project that I am working on that requires the use of the Mysql Connector for NHibernate, (Mysql.Data.dll). I also want to reference another project (Migrator.NET) in the same project. The problem is even though Migrator.NET is built with the reference to MySql.Data with specific version = false, it still tries to reference the ...

lazy-loading fails when session got disconnected

We use one (read-only) session which we disconnect as soon as we retrieve the data from the database. The data retrieved, often has lazy-loaded properties which are not initialized yet. When we try to access the properties, the following exception gets thrown: NHibernate.LazyInitializationException Initializing[NHibernateTest.AppUser#...

How to organize a ASP.NET MVC solution (DDD)

Hello everyone. I am trying to start a new project (asp.net MVC) and I would like to apply some DDD rules I've learned in these last few months. I don't know how to organize my solution though. I would like to use Nhibernate but I don't want to use Fluent Nhibernate cause it must be something like an experiment. I've seen some examples w...