nhibernate

Deleting a row with custom sql statement in Nhibernate

I am using NHibernate and have a requirement where in when i am deleting a row i should not hard delete the row instead update the status to delted and set few system properties like who deleted etc. For doing this i have decided to go with custom sql statement like. <sql-delete> update PPDE set SysStatusID = 2 where PPDID =? </sql-...

Querying Overriding Entities Using a Self Join and the NHibernate Criteria API

I have a simple Waiver model, and I would like to make a query that returns all the Waivers that are not overridden. public class Waiver { private readonly int id; protected Waiver() { this.id = 0; } public virtual int Id { get { return id; } } public virtual string Name { get; set; } public virtua...

Fluent NHibernate FluentMappings.AddFromAssemblyOf<> Issue

A coworker and I were recently doing the backend for a small application using Fluent NHibernate. We wrote our entities, mapping files, persistence manager, but for some reason we couldn't export the database schema to anything. Through the debugger we discovered that the FluentMappings.AddFromAssemblyOf was returning 0 mappings, even t...

Fluent Nhibernate Nunit Test Error

I am trying to learn Nhibernate using fluent nhibernate mappings and i have created a small test app. Below is the code: UserClass: public class User { public string UserName { get; set; } public string Password { get; set; } public string Role { get; set; } public string Email { get; set; } public DateTime JoinDate...

Where do I download Iesi.Collections from?

Hi, Trying out nHibernate, it says it can't find Iesi.Collections. Where can I get this from? Shouldn't it ship with the nHibernate download if it is so vital? ...

With nHibernate, how can I manage my hibernate.cfg.xml file in both my web app and test project?

Hi, Seeing as the hibernate.cfg.xml file has to be in the running application (in this case a web application), what is the best way to have the file in both my test project and my web app project? ...

NHibernate open source POC

Are there any open source projects that use NHibernate and which serve as a proof of concept for NHibernate. I'm looking for concrete proof of NHibernate's ability to meet enterprise standards in terms of performance and scalability mainly. Especially interesting would be use of batching. I'm not sure how synched NHibernate and Hibernat...

NHibernate proxy causing problems with databinding

I have a gridview that is bound to the result from an nhibernate query. If the first item in the list is edited the following exception is thrown: System.Reflection.TargetException: Object does not match target type It appears that the problem is caused by the fact that databinding can't deal with the first item in the list being a sub...

NHibernate: need to update object ID with @@identity after insert

I'm using NHibernate for the first time and struggling. On web page one, I start a form. I want to save and navigate to page two. How do I update my RequestForm object with the ID of the newly inserted row? It is still 0 when I call the redirect, though the data was persisted to the DB. Here's my controller code: [AcceptVerbs(HttpV...

nHibernate and how it accesses the database, do parameters take type/size into consideration?

Does nHibernate create code that has all the details of the column? I know with regular ado.net it increases performance if you have your sql paramters with the column details like: column name, size, sqltype. ...

Will hql give you compile time errors?

Will hql give you compile time errors like criteria query? I remember hearing that one of the methods doesn't (besides raw SQL). ...

type safe and nhibernate

Hi, Is it possible to create 100% type safe compile time checking code? Even criteria seems to reference column names with a string reference "Username", but if you put "Usernnameaa" it will fail at runtime right? ...

How could nHibernate not be 100% compile time tested?

One thing that bothers me about nHibernate is that it is not 100% compile time tested. If I rename a column in my database table, and I update the mapping file for that table, when I hit compile I should get errors in all my query code (hql/criteria whatever) of where I referenced that column name and how it is spelled wrong. The whole...

Fluent NHibernate Automapping error

This one has me scratching my head, so I'm hoping a second pair of eyes can help me out here. Setup: I've got a base class called DomainEntity that all of my data transfer objects use. It basically only defines a property called Id (which is an integer). I've got data transfer objects: Blog, Post, User DomainEntity is in the namespace...

What's the simplest way to preserve a NHibernate ISessionFactory for web pages and web services?

What's the simplest way to preserve a NHibernate ISessionFactory for web pages and web services? I'll get into the Rhino Commons and Windsor this and that later. I'm looking for the basic concept. Is this correct? I've been trying to find guidance on how to deal with the ISessionFactory as simply as possible. I'm also looking for a...

nhibernate Linq

I am using the old linq provider for nHibernate and waiting patiently for the new one to come out. I am sure it will save me much pain. Anyway, I have a problem with the code below as it generates a "Object reference not set to an instance of an object". The line "c.Disciplines.Any(d => disciplines.Contains(d))" is the one causing the pr...

Fluent Nhibernate and MySql, problems with dialect

I have question about fluent nhibernate and mysql. I'm doing this: Fluently.Configure() .Database(MySQLConfiguration.Standard.ShowSql()) .Mappings(m => m.FluentMappings .AddFromAssemblyOf<ShopperMapping>()) .BuildConfiguration();SchemaExport exp = new SchemaExport(cfg); exp.Execute(true, false, false, true);...

fluent nhibernate mapping a component with reference

Is this possible... MessageMap() { Id(x => x.Id); HasMany(x => x.Folders) .Component(c => { c.Map(x => x.Name); c.References(x => x.User); }) .Cascade.All...

Is Unit of Work more efficient if I don't care for transactions etc?

Hi, If I have 10 database calls on my web page, and none of them require any transactions etc. They are simply getting data from the database (reads), should I still use the unit of work class? Is it because creating a new session per database call is too expensive? ...

Using nHibernate, how can I get the newly inserted ID during an Add?

When I am adding a new row in the database, I noticed the Add method returns void. Is it possible to get the newly created row's ID returned in the add operation? ...