Information about NHibernate

I am new to NHibernate. Can someone explain to me how this relates to a large dataset?

If I have 100GB of data I want to get through Nhibernate I think it is possible with ISession. If I use ISession, will it keep in memory? If it is stored in memory, if any changes to the database are done, what will happen?

These doubts can lead me to confusion. Can anyone suggest me?

Thanks in advance

0


a source to share


2 answers


The NHibernate session not only implements the Unit of Work pattern, but also implements the Identity Map pattern.

That is, when you first fetch an object from datastore in a session, NHibernate will fetch that object from the DB.

If you want to retrieve the same object again with the same session , then NHibernate will not fetch it from the DB, but it will return the reference it already fetched. Offcourse, this is only true if you are using the same session instance when you retrieve the same object a second time.



When you make changes to an entity and in the meantime someone else changes the same object and saves those changes to the DB, then in the end you won't see those changes as you cannot expect NHIbernate to keep track of all database and checks if someone else has modified (and saved) the object you have in memory.

Therefore, it is recommended that your sessions be short lived. In order not to overwrite any elses changes, you can easily implement optimistic locking in NHibernate.

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

0


a source


I don't know what you want to do with the data, so I can't give you a good answer. When you are talking about 100GB I am assuming you want to transfer data to another database or storage medium. Why aren't you looking at an ETL tool ?



0


a source







All Articles