tags:

views:

69

answers:

2

Hello All,

I am new to NHibernate.Can anyone explain me How it deals with Large set of data?

If I have 100gb of data ,i want to retrieve through Nhibernate,i think it is possible with ISession. If I use ISession,will it store in memory?If it stores in memory,if anychanges are done to database what will happen?

Those doubts can lead me in a bit confusion.Can anybody suggest me?

Thanks in advance

A: 

The Session of NHibernate does not only implement the 'Unit Of Work' pattern, but it also implements the 'Identity Map' pattern.

That is, when you retrieve an entity from the datastore for the first time in a session, then NHibernate will retrieve that entity from the DB.

When you want to retrieve that same entity again using the same Session, then NHibernate will not fetch it back from the DB, but it will return the reference that it has already fetched. Offcourse, this is only true if you use the same Session instance when you fetch that same entity for the 2nd time.

When you make changes to an entity, and in the meantime someone else changes the same entity and persists those changes to the DB, then, offcourse, you will not see those changes, since you cannot expect that NHIbernate keeps track of the entire database, and checks if someone else has changed (and persisted) an entity that you have in memory.

Therefore, it is advised that your Sessions should be short-lived. In order to not overwrite someone elses changes, you can easily implement optimistic locking in NHibernate.

But, I wonder ... Are you sure that NHibernate is a good solution for your problem ? What kind of application are you going to build ?

Frederik Gheysels
Thanks for your reply.Mainly my application is to dealing with large chunks of data.To retrieve the large chunks of data at a time and do manipulations and presenating those data into windows and webforms.Is it advisable to use NHibernate for this purpose?
What do you do with your data ? Are it mainly CRUD operations with very few business logic ?How do you model this data ? You will be able to do it in NHibernate, but in some cases it could be better to not use NHibernate.
Frederik Gheysels
I will use those data mainly for CRUD operations only.can you please explain me some cases that doesn't use nhibernate?Thanks
A: 

I don't know what you want to do with the data, so I can't give you a good answer. When you're talking about 100GB I suppose you want the transfer the data to another database or storage medium. Why don't you look at some ETL tool?

Paco