nhibernate

Book recomendation on ORM

What is a good book(s) on NHibernate in .Net or any other ORM? ...

Maintain denormalized data with NHibernate EventListener

I have one bit of denormalized data used for performance reasons and I'm trying to maintain the data with an NHibernate event listener rather than a trigger. I'm not convinced this is the best approach, but I'm neck deep into it and I want to figure this out before moving on. I'm getting following error: System.InvalidOperationException...

Hibernate updating database structure with new indexes

Hi All. It's well known fact that hibernate work with indexes in a very strange way. It generate them only if you create a database schema from the scratch. But if you try to update the database schema hibernate will ignore new indexes. My question is, does anybody find a solution how to ask hibernate generate SQL for new indexes durin...

Calling an Oracle store procedure with nHibernate

I've got a stored procedure in Oracle: procedure Test(results OUT gencursor, id in number) is v_cursor gencursor; begin OPEN v_cursor FOR select id, name, age from tblcustomers s where s.id = id; results:=v_cursor; end Test; Now, i'd like to execute this procedure using nHibernate ISession.CreateSQLQuery. All the examples ...

NHibernate many-to-one association refuses to load

I have the following mapping, the many-to-one property 'Message' has a corresponding one-to-many association in the 'RootMessage' class. <class name="IMessageReceipt" lazy="false" table="MessageReceipts" abstract="true"> <id name="Id"> <generator class="guid.comb"></generator> </id> <discriminator column="Discrimi...

nHibernate/Fluent - SQL Query Question

I am new to nHibernate. I understand how to use mapping using Fluent nHibernate. Now I would like to use a little more complex query. However I am not sure how I would map or even approach this. Here is what I would like to do in an sql query: SELET Zone, CountOfStyles = (Select Count(1) from anotherTable Where StoreZoneId = zone.Z...

mixing NHibernate with 3 tier developing

I have a 3 tiered app: 1st layer: SQL DB. 2nd layer: App Sever (dotnet) 3rd layer: smart wpf client. I'm using NHibarnate (fluent) as the data source for the application server layer (App server- 2nd layer talks to DB using NH) Application layer talks to the client using WCF. Do I benefit anything from using NH - as WCF doesn't suppo...

How to properly configure NHibernate event listeners

I'm trying to use an event listener for the first time. All samples I've seen show how easy it is to configure, but for some reason I'm having trouble - it doesn't seem to be called. I suspect I'm missing something obvious. I've tried this: <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory name="...

NHibernate paging with SQL Server

When using SetFirstResult(start) and SetMaxResults(count) methods to implement paging I've noticed that the generated query only does a select top count * from some_table and it does not take the start parameter into account or at least not at the database level. It seems that if I instruct NHibernate to execute the following query: var...

NHibernate.Caches.SysCache version issues with Nhibernate 2.1.0 branch

We've branched NH 2.0.1 for some minor changes and that worked fine. Our upgrade to 2.1.0 has dll issues with NHibernate.Caches.SysCache being built against a different NH. My main question is how do best deal with this? Can I use some type of assembly mapping, or is there source code I can use to build against? Here is the error: "C...

Getting the ID(Autonumber) after the session saved in nhibernate?

Hi i am inserting a row of data into a table through nhibernate, how to get the Id(auto number)of the last inserted row? please help me... ...

Reload association/related collection in NHibernate

If I have Order entity with a list of OrderDetails I can easily eager load the detail along with the order by using NHibernateUtil.Initialize(Order.Details). So obviously the NHibernate have all the information to generate the sql statement. But how do I query the database for just the Details (similar to CreateSourceQuery in Entity Fram...

Is the book "NHibernate in Action" for V1.2 of NHibernate still relevant in October 2009?

Manning is running a special on "NHibernate in Action" for $10. NHibernate In Action was released in February 2009 for V1.2 of NHibernate. Currently, NHibernate is up to V2.1. Will the book about V1.2 be relevant enough to apply towards the current release of NHibernate. I don't want to waste my time and money on a book about deprecated ...

NHibernate forces UPDATE-statement when I access child

Hi, I have a parent to child relationship. My problem is, when I access the child object, and afterward flushes the session, NHibernate automatically UPDATE's the child objects with the same values (no differences). This will issue an update of the child: Response.Write(Profile.ProfilePicture.Filename); _session.Flush(); Can anyon...

NHibernate Transactions on Reads

I have read the documentation and explanation on why it is highly recommended to use transactions on read operations in NH. However, I still haven't totally "bought" into it yet. Can someone take a stab at explaining it without just telling me to RTFM, which I have already done? ;) ...

IFNULL equivalent in Hibernate Query Language?

I'm trying to write an HQL query which will calculate an average rating for an item. I want the query to return 0 instead of null when there are no rating for a given item - so that I can use my query as a subquery. So is it possible? Is there an HQL equivalent of IFNULL or NVL? ...

Many-to-many collection mapping in NHibernate

My application is a multi-user podcast aggregator, using NHibernate 2.1 (and .NET 4.0 if that changes anything). I'm also a complete NHibernate n00b. Details of each podcast are only stored once, and Users subscribe to podcasts, so there is a many-to-many mapping between podcasts and users which I have mapped in my database with a Subs...

NHibernate Attributes Mapping List

Hello, I'm a new NHibernate developer. I'm using attributes and not map files and I have configured the application to create the tables automatically. I Have two classes , Group and User. Withing the Group class I have a list of users public class Group { [NHibernate.Mapping.Attributes.Id(Name = "GroupId")] [NHibernate.Mapp...

How do I use NHibernateMaps for foreign keys?

I have the following class: public class Element { public Guid Id { get; set; } public ElementRouting route { get; set; } } An Element can be routed to another element in a parent-child - like relationship represented by the following class: public class ElementRouting { public Guid Id { get; set; ...

Problem with create criteria in nhibernate

I have an entitiy as public class ClaimDetail { public virtual int Id { get; set; } public virtual Claim Claim {get;set;} public virtual string ServiceDateFrom { get; set; } public virtual string DateCreated { get; set; } public virtual ClaimDetail ParentClaimDetail { get; set; } } I want apply left outer join on ...