nhibernate

Database choices

I have a prickly design issue regarding the choice of database technologies to use for a group of new applications. The final suite of applications would have the following database requirements... Central databases (more than one database) using mysql (must be mysql due to justhost.com). An application to be written which accesses the...

NHibernate Save Details Performance

Hi, I am new to NHibernate. As I am doing some dummy applicaiton to learn, I got a doubt. I request you please clarify me on my question. I am doing a reset password page in which I am fetching the user details and resetting the password and save back to the database. 1) Do I need to retrieve complete(whole row) details of the user. 2...

nHibernate Restrictions Contains

I have a evaluate expression like mentioned below Restrictions.In(criteriaItem.PropertyName,criteriaItem.FilterValues); Restrictions.Like(criteriaItem.PropertyName,criteriaItem.FilterValues); i want Contains how do i do that? ...

NHibernate - does it work well with database-level cascading deletions on foreign key constraints

Dose nHibernate play well with database level cascading deletions? What I mean is that if I have a constraint set at the RDBMS level to cascade delete all orphans, will nHibernate invoke any custom delete logic at the application level if I were to delete an entity though nHibernate? Or should I remove the cascading deletions from the RD...

Totally lost in select Count in ICriteria

I have a very simple class: class Product { public virtual int ID { get;set;} public virtual Categori MainCategori { get;set;} } i would like to make a "Select Count(ID),MainCategori From Products Group By MainCategori" by Using ICriteria. My code is like follows using (var sessionFactory = C...

Nibernate, DynamicProxy, and Spring AOP

We have an Spring IOC managed application that uses NHibernate in its persistence layer. We have use the Spring AOP and understand its terminology and capabilities. We have some investment in Spring proxies. Now, we want to add a PropertyChangedMixin and a ValidatorInterceptor (not nhibernate validator, but based on Spring validation) ...

NHibernate BusinessRules

I need implement business using nhibernate ORM I have two entites Project (Id,Name,Effort) Task (Id,Name,Effort) I need update Effort in Project when Effort in Task changes. How to do it ? I have planed to use event system build in nhibernate but still don't know how to access to Project entity within Task Event Here is EventListene...

strange nhibernate exception?

Hi i am gettin a strange exception in may windows service application, but it was working fine for a long time and suddenly gave this error: "(0xc0000005 at address 5A17BF2A): likely culprit is 'PARSE'." 2010-05-11 07:00:03,154 ERROR [0 ] [NHibernate.Cfg.Configuration.LogAndThrow] - Could not compile the mapping document: xxxx.hbm.xml...

Linq2SQL vs NHibernate performance (have I gone mad?)

I have written the following tests to compare performance of Linq2SQL and NHibernate and I find results to be somewhat strange. Mappings are straight forward and identical for both. Both are running against a live DB. Although I'm not deleting Campaigns in case of Linq, but that shouldn't affect performance by more than 10 ms. Linq: ...

Sharp architecture; Accessing Validation Results

I am exploring Sharp Architecture and I would like to know how to access the validation results after calling Entity.IsValid(). I have two scenarios e.g. 1) If the entity.IsValid() return false, I would like to add the errors to ModelState.AddModelError() collection in my controller. E.g. in the Northwind sample we have an EmployeesC...

Prevent Nhibernate schemaexport from generating foreign key constraints on has many relationship

I have a mapping like this: HasMany(x => x.Orders).KeyColumn("CustomerID"); Which is causing a constraint like this to be generated by schemaexport: alter table [CustomerOrder] add constraint FK45B3FB85AF01218D foreign key (CustomerID) references [Customer] I have tried adding .NotFound.Ignore() like on a References(...

How do I create/use a Fluent NHibernate convention to automap UInt32 properties to an SQL Server 2008 database?

I'm trying to use a convention to map UInt32 properties to a SQL Server 2008 database. I don't seem to be able to create a solution based on existing web sources, due to updates in the way Fluent NHibernate works - i.e. examples are out of date. I'm trying to have NHibernate generate the schema (via ExposeConfiguration). I'm happy to ha...

nHibernate Distinct query

Code IList VendorList; VendorList = session .CreateCriteria<VendorLookup>() .Add(Expression.Eq("NetworkRunId", networkRunId)) .Add(Expression.Not(Expression.Eq("VendorName", " "))) .SetResultTransformer(new NHibernate.Transform.DistinctRoo...

NHibernate + Paging + Ordering

I'm not quite sure of the most elegant solution for what I am trying to do. I have a page which lists music listings, there can be thousands of these so they are paged in batches of 20, I also have 4 links at the top of the page to change the way these listings are ordered. The sort by properties could be located on different entities ...

NHibernate From One-To-Many to One-To-One

I am creating the security system for the software im creating and I would like to know how i can do the following in NHibernate(if at all possible) User Account Class: public class UserAccount { public virtual int UserID { get; set; } public virtual String Username { get; set; } public virtual Privilege InvoicePrivilege { ...

Castle ActiveRecord fails to detect DAO field in some queries

This query works fine: DetachedCriteria filter = DetachedCriteria .For(typeof(NotificationRecord), "nr") .Add(Expression.Eq("nr.Submission.Id", 5)); return ActiveRecordMediator<NotificationRecord>.FindAll(filter); This query fails with the exception message: could not resolve proper...

Using an ORM with a database that has no defined relationships?

Consider a database(MSSQL 2005) that consists of 100+ tables which have primary keys defined to a certain degree. There are 'relationships' between tables, however these are not enforced with foreign key constraints. Consider the following simplified example of typical types of tables I am dealing with. The are clear relations between t...

NHibernate Memory Leak

My company has an ASP.Net application that runs out of memory and throws out of memory exceptions after only a couple of days of activity by our customers. I am able to reproduce the error in our testing environment and I created a hang dump using adplus. When looking at the largest/most objects on the heap I noticed that we have over ...

Switching from Wilson ORMapper, what are my best alternatives?

We're currently using Wilson ORMapper with our asp.net 2.0 website against an Oracle db and we're having some issues that is making us look into an alternative ormapper. I know there is nhibernate but are there any other we should look into for our environment (.net and oracle db) or has nhibernate become the industry leader and therefo...

Help creating a ColumnName Convention using FluentNHibernate

I've been trying to specify a custom naming convention for my database table columns. So far, I have been able to setup a convention for the table's name, but not the actual columns. I've seen a few guides on the internet, but they're not working using the latest Fluent NHibernate (1.0.0 RTM). public class CamelCaseSplitNamingConvention...