nhibernate

NHibernate : map to fields or properties ?

When you create your mapping files, do you map your properties to fields or properties : <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Foo" namespace="Foo.Bar" > <class name="Foo" table="FOOS" batch-size="100"> [...] <property name="FooProperty1" access="field.camelcase" column="FOO_1" type="string" length="5...

Getting stated with NHibernate. Real world project example?

One of my goals over the next few months is to get familiar with NHibernate and am curious if anyone out there has any suggestions of where to begin. Preferably, I'd like to find a example project that demonstrates what you would see in an in-the-field application. ...

nHibernate isn't retrieving manually changed data

nHibernate is not able to retrieve manually changed data from repository table? I have disabled second level cache also but looks like it(nhibernate) is retrieving sometimes from cache and sometimes from repository table. ...

Does Anyone Have Experience Creating an Occasionally-Connected Browser App With NHibernate?

We need to make our enterprise ASP.NET/NHibernate browser-based application able to function when connected to or disconnected from the customer's server. Has anyone done this? If so, how did you do it? (Technology, architecture, etc.) Background: We develop and sell an enterprise browser-based application used by construction field pe...

Best place for NHibernate documentation?

I've been looking for good documentation for nhibernate, specifically version 2.0. I've recently returned to .NET development and for the life of me, I can't find the right sort of documentation (or even the most recent). Any suggestions would be greatly appreciated. ...

How can I retrieve latest from database using NHibernate after an update?

Here is the scenario: I have a winforms application using NHibernate. When launched, I populate a DataGridView with the results of a NHibernate query. This part works fine. If I update a record in that list and flush the session, the update takes in the database. Upon closing the form after the update, I call a method to retrieve a ...

Using Microsoft Velocity with NHibernate?

Has anyone tried to use MS Velocity with NHibernate. I've seen that NHibernate can use NCache as a distributed cache, but I am more interested in using MS Velocity instead. Are you aware of Cache Provider for MS Velocity for NHibernate? ...

Why isn't my NHibernate bag collection setting the 'parent id' of the children dynamically?

I have a new object with a collection of new objects within it on some property as an IList. I see through sql profiler two insert queries being executed.. one for the parent, which has the new guid id, and one for the child, however, the foreign-key on the child that references the parent, is an empty guid. Here is my mapping on the par...

NHibernate + JSON/Ajax Parent/Child Relationships? Why no workie?

I have a typical parent/child relationship. Writing news in .NET and adding children works fine, NHibernate plays nice and adds the correct relationships. However, when passing a JSON object from the client to some method that serializes my JSON into the .NET representation, NHibernate seems to get confused. It comes up with the correct ...

NHibernate ICriteria - Does the sort allow for null?

Using NHibernate ICriteria and adding .AddOrder ... I want to sort by a property that is sometimes null with all the populated ones at the top. Will .AddOrder allow me to do this? If not is there an alternative? The sorting options for ILists leave a lot to be desired. ...

Caching the sessionfactory

As far as I've gathered (read: measured), building the configuration and the sessionfactory by far takes the most time in executing a query using nhibernate. Is there anything against making the sessionfactory static, so it will only be configured once per appDomain? I know there are locking and racing issues when using this approach, b...

Validation Block vs Nhibernate.Validator

I am looking for validation framework and while I am already using NHibernate I am thinking of using NHibernate.validator from contrib project however I also look at MS Validation Block which seem to be robust but i am not yet get into detail of each one yet so I wonder has anyone had step into these two frameworks and how is the experie...

NHibernate Query problem

I'm quite new to NHibernate and starting to find my way around. I have a domain model that is somewhat like a tree. Funds have Periods have Selections have Audits Now I would like to get all Audits for a specific Fund Would look like this if I made it in SQL SELECT A.* FROM Audit A JOIN Selection S ON A.fkSelectionID = S.pkID JOIN Pe...

How do you map enums to and from the database using NHibernate?

Edit: Ryan raised a good point. I specifically want to be able to map to and from while still storing human-readable values in the database. That is, I don't want a bunch of enumeration integers in my database. ...

additional fields in NHibernate many-to-many relation tables

when i have a many-to.many relation with nhibernate and let nhibernate generate my db schema, it adds an aditional table that contains the primary keys of the related entities. is it possible to add additional fields to this and access them without having to hassle around with sql manually? ...

How to combine cascading updates/deletes between SQL Server and NHibernate?

I am writing an application with a hand-crafted domain model (classes) and a hand-crafted data model (tables/relationships), and letting NHibernate take care of the mapping. Is it best to tell the database to perform cascading updates or deletes or to tell NHibernate to do it (cascade="all-delete-orphan")? Can they both be set up to do ...

NHibernate - Difference between session.Merge and session.SaveOrUpdate?

I noticed sometimes with my parent/child objects, or many-to-many relationships, I need to call either SaveOrUpdate, or Merge. Usually, when I need to call SaveOrUpdate, the exception I get on calling Merge has to do with transient objects not being saved first... Please explain the difference between the two. ...

Combine Fluent and XML mapping for NHibnernate

Hi, I just fell in love with NHibernate and the fluent interface. The latter enables very nice mappings with refactoring support (no more need for xml files). But nobody is perfect, so I am missing the many-to-any mapping in fluent. Does anybody know if it is already there? If so, a simple line of code would be nice. But to stick to t...

NHibernate session management in Windows Service applications

Hi all, I'm developing and application that runs as a Windows service. There are other components which include a few WCF services, a client GUI and so on - but it is the Windows service that access the database. So, the application is a long-running server, and I'd like to improve its performance and scalability, I was looking to impr...

nhibernate - sort null at end

Using NHibernate from C# and only HQL (not SQL) in a way that is compatible with MS SQL Server 2005/2008 (and preferably Oracle). Is there a way to write the order by clause so that nulls will sort at the end of the query results while the non-null results will be sorted in ascending order? Based on the answer to the question reference...