nhibernate

What does nhibernate have, that entity framework 4 is missing?

Hi all, We're trying to decide if it's worth using entity framework 4 on a project. To that end, I think a good place to start would be by comparing it to nhibernate, which is mature and proven by years of use to have all the features people need for enterprisey apps, and find out what features nHibernate has that EF4 is missing out on....

NHibernate 3.0 beta1 Bidirectional One-To-Many Cannot Add Child Object

Hi guys, In short, the problem is that, when add child object to the collection property of the parent object without explicit setting the parent property of the child object, the insert will fail. Let's take a example: NOTE: I'm using NHibernate 3.0 beta1. Example: Product-Category Senario: (1) Database Schema: Category (Id, Name)...

NHibernate Entity access through projection

I have this mapping file: 'class name="WebTools.Data.Common.IHObjekt, WebTools.Data" table="IHObjekt"' .... 'property name="TYPBEZEICH" type="string"' ... 'many-to-one name="standort" column="STANDORT_ID" fetch="join"' And I would like to use a 'Projections.ProjectionList()' to reduce the number of returned columns from the...

What is IDetachedQuery and its difference with DetachedCriteria?

Hi, What is IDetachedQuery and its difference with DetachedCriteria? How and when IDetachedQuery is used? UPDATE: I'm using NHibernate 2.1.2.4000 ...

NHibernate double fetching for non-existent many-to-one relationship

I have an entity with several Many to One relationships and I've found I can eagerly fetch them in one query like such: public Accommodation GetEager(int id) { IList<Accommodation> query = NHibernateSession.CurrentFor(NHibernateSession.DefaultFactoryKey) .CreateQuery(@" select a from Accommodation as a left j...

Problem with Identity generation when using nHibernate with MySql

Please, help! I new to nHibernate and I stuck on problem - I can't create new persisted object via NHibernate (2) In this code: foreach (var item in items) { if (item.price > 0) { if (_itemsForBuy.FirstOrDefault(i => item.itemid == i.itemId) == null) { var ifb = new ItemForBuy() { id = 0, item = item, count = 1...

How to Queue The Add Operation in NHibernate?

Hi guys, Is there some way to queue the "Add" operation in NHibernate, just like Linq to SQL and Entity Framework does? I want to add an entity to the repository, but I don't want to save it to the database immediately, because the business logic is complex. I want to submit all changes when I call ITransaction.Commit(), just like Ent...

Nhibernate mapping to a dynamic many-to-one

Hi, I have an entity that I want to reuse across projects. The entity needs to know its parent which is generally mapped with something like this: <many-to-one name="Parent" class="ParentClass, parent.assembly" column="parentuid" not-found="exception" not-null="true" lazy="proxy" cascade="none"/> The same entity can be used by many ...

NHibernate beginer examples

i'm beginer of NHibernet. i search many web site for simple NHibernate program,that program have some error,,so need help for NHibernate setp by step processing.....please any one help me.... ...

Fluent nHibernate , IDictionary Confusion

Using the following classes.. public class Trait { public virtual int Id { get; set; } public virtual string Name { get; set; } } public class Sheet { public virtual int Id { get; set; } public virtual IDictionary<Trait, int> Influences { get; set; } } I have tried to map them using Fluent nHibernate, as such. public ...

NHibernate caching entities across sessions

I'm developing a web application and I would like caching to persist across web requests. I am aware that the first level cache is per-session only. I have second-level caching enabled and this is working for queries. However, the second-level cache does not seem to work for "getting" entities... therefore most of the DB work the appli...

NHibernate - LINQ Limitations

Hi, i've been using Nhibernate with LINQ a fair bit now and i have a few issues. Say i have the following entities: public class User { public virtual int UserID { get; set; } public virtual bool IsActive { get; set; } public virtual bool SomeField { get { return 0; } } public virtual DateTime DateRegistered { get; set;...

NHibernate event listeners

I'm trying to add an implementation of IPostLoadEventListener to my NHibernate configuration using FluentNHibernate. I can do so as illustrated here: http://stackoverflow.com/questions/1433638/how-to-add-event-listener-via-fluent-nhibernate However, creating a new array to replace the old one completely discards any existing event list...

nhibernate : Need to attach references before Update<T>(T entity) ???

Hi all, I'm, building an n-tier system using nHibernate i de back-end, and which is cummunicating using REST/json with the front-end. When i send an object to the back-end, I only send the data like : myAddress: [ { guid: "1", street: "MyHomeStreet", houseNumber: "34", city: "6" } ] So, I only send the referenced city entity's...

Is it possible to get NHibernate to auto-generate an ID if the entity does not have one, or use the ID of the entity if it already has one?

According to REST philosophy, a PUT operation should (taken from Wikipedia): PUT http://example.com/resources/142 Update the address member of the collection, or if it doesn't exist, create it. NHibernate seems to have two ways of dealing with entity IDs: Auto-generate an ID, regardless of what value the user set. Use the ID as...

Execute a SQL stored procedure before every query generated by EntityFramework

I need to execute a SQL stored procedure every time before I query my ObjectContext. What I want to achieve is setting the CONTEXT_INFO to a value which will be later on used with most of my queries. Has anyone done that? Is that possible? [EDIT] Currently I'm achieving this by opening the connection and executing the stored procedure...

NHibernate with NLog or Log4Net or something else?

I want to use NHibernate in my project, and it comes with log4net by default. In my opinion, it would be a wiser choice to go for Nlog as it still gets updates, log4net on the other hand is completely outdated. Is there a best choice because I don't really believe in using outdated technologies in my application. On the other hand, it'...

NHibernate with Not IN

select count(*) from employee where not exists (select * from salary where employee_id = employee.id) can some one please wirte in Criterai Query ...

Build NHibernate ORM from Oracle database

Hi there, I'm analyzing a project in asp.net with mvc and would like to use NHibernate as ORM. All over the net I find books, tutorials, quick start guides to work with SQL and Linq-to-Sql but allmost never for Oracle. What is the best setup? In my project we have a rather small database in Oracle and I prefer to have model that is cr...

Requirements for entities in NHibernate to be used in a HashedSet.

I would like to use the Iesi.Collections HashedSet class for entity collections in NHibernate. The functionality I want is that duplicate entities cannot be added. I would like entities to be considered duplicate if they share the Id (i.e. primary key) field, or, if they have Id == 0 (i.e. unsaved), then certain key properties are compar...