Does the NHibernate session object use a lot of server RAM?

Does the NHibernate session object use a lot of server RAM?

It depends on website traffic, but does the session object get very big in terms of memory usage?

-------------Problems Reply------------

The ISession object is a very lightweight object, ISessionFactory not.

It can - it depends on how you're using it. The session is your unit of work, so typically only exists for a short period of time. It acts as your first level of cache, storing the entities that it has dealt with throughout its lifetime.

If you're keeping your sessions alive for a long time, they will potentially become more and more bogged down with cached entities. In certain scenarios, you can use ISession.Evict to remove an entity from the session if there's no reason for it to be kept in there.

Category:nhibernate Views:1 Time:2009-12-25

Related post

  • How to retrieve current NHibernate Session object from Castle ActiveRecord SessionScope 2011-11-03

    I have an open Castle ActiveRecord SessionScope. I need to use the nhibernate session wrapped into SessionScope. How can i retrieve the current NHibernate Session Object from SessionScope? thank you very much for the replies. [update] i have this cod

  • Requested operation requires an OLE DB Session object- - Connecting Excel to SQL server via ADO 2009-11-03

    I'm attempting to take Excel 2003 and connect it to SQL Server 2000 to run a few dynamicly generated SQL Queries which ultimately filling certain cells. I'm attempting to do this via VBA via ADO (I've tried 2.8 to 2.0) but I'm getting an error while

  • View NHibernate session objects 2012-03-15

    I keep getting an error when i delete an object from a collection that it will be resaved because it exists in other collections. In the current session only the collection I am working on exists. There aren't any others. So I think NHibernate is tel

  • Can I detach an object from an NHibernate session? 2009-06-29

    If I've gotten a persistent object from the database via NHibernate's Get() or Load() methods, is there a way for me to detach that object from its NHibernate session so that changes to it will not automatically be persisted? --------------Solutions-

  • How to properly use a NHibernate ISession object - Session Is Closed! errors 2009-09-24

    I'm running into issues with my ISessions in NHibernate. I keep getting "Session Closed!" errors. Can some one please show me the correct pattern including a definiion of the following methods and when to use each: ISession.Close() ISession.Dispose()

  • Object gets disconnected from nHibernate session after TryUpdateModel is called 2010-07-22

    This works: public ActionResult Save(int id, string name) { var profile = _profileRepository.GetById(id); profile.Name = name; _profileRepository.Save(profile); //this calls SaveOrUpdate() //session.Commit() gets called in global.asax on Application_

  • Close NHibernate session after WCF serialized return object 2011-01-31

    I have an IIS hosted WCF service with single-call behavior. I use Fluent NH for data access and faced the following issue. I cannot close/dispose NH session inside of method body because when serialization comes to the game it cannot access lazy load

  • Why is NHibernate saving objects when I never execute session.Save? 2011-03-18

    I'm using NHibernate with Fluent NHibernate. I have code where I start a transaction, then I enter a loop which creates several objects. For each object I check certain conditions. If these conditions are met, then I execute a session.SaveOrUpdate()

  • NHibernate Session refresh call on baseclass object causes invalid cast exception 2012-03-13

    I am using the following fluent mapping for two classes : 1.Application class : public ThirdPartyAppMap() { Schema("Data"); Id(x => x.ThirdPartyAppId).GeneratedBy.Identity(); Map(x => x.AppName); Map(x => x.CreationTime); Map(x => x.Enabl

  • nHibernate session and multithreading 2008-10-28

    I had a method with a lot of persistence calls that used a nHibernate session, it worked, was alright. But I needed to refactor this method, extracting a method from a content inside a loop, for multithread reasons. Then I created an class with this

  • Can I flush my NHibernate session and get a new session without committing the transaction? 2008-11-01

    I'm using Castle ActiveRecord for persistence, and I'm trying to write a base class for my persistence tests which will do the following: Open a transaction for each test case and roll it back at the end of the test case, so that I get a clean DB for

  • How to manage NHibernate sessions in a long lived Windows forms application? 2008-12-05

    We are using NHibernate to manage our persistence in a complex modular windows forms application - but one thought keeps bothering me. We currently open a session on launch and open all objects through that session. I am worried that all loaded objec

  • NHibernate session management in ASP.NET MVC 2008-12-13

    I am currently playing around with the HybridSessionBuilder class found on Jeffrey Palermo's blog post: Using this class, my repository looks like this

  • Get list of changed fields in Entity from NHibernate Session 2009-06-25

    I want to track changes in my domain model. I know that NHibernate ISession is an inmplementation of UnitOfWork pattern, so it tracks this changes. Is there any way to pull out them, for example, before Commit() or Flush()? --------------Solutions---

  • Datacontext and Nhibernate Session 2009-07-04

    I am a newbie to Object Oriented Programming. I am working with Windows Application and Model View Presenter Pattern and I want to have the Change tracking available. My question is as follows Do I need the presenter to hold a Nhibernate Session or L

  • How long can/should an NHibernate session be kept open? 2009-08-07

    I've created a windows service which is listening to a MSMQ. For each message I receive, some DB transactions need to be made. Later it might be possible that there will be 1 message every second. Currently the Nhib session is kept open until the ser

  • How do I serialize an NHibernate DetachedCriteria object? 2009-08-07

    I am looking for a solution to persist NHibernate DetachedCriteria objects to a database. I have tracked down the NHibernateUtil and the GetSerializable method, but I'm unsure how to use it to serialize a DetachedCriteria object. Any help on this wou

  • nhibernate session for different database servers with same entity 2009-11-10

    We use two databases in our web-application. One is located in USA and one is in Canada. You should see only the data based on your country. Now I think there will be a problem when it comes to create the SessionFactory objects, because the entities

  • NHibernate session.flush() fails but makes changes 2009-12-05

    We have a SQL Server database table that consists of user id, some numeric value, e.g. balance, and a version column. We have multiple threads updating this table's value column in parallel, each in its own transaction and session (we're using a sess

Copyright (C), All Rights Reserved.

processed in 0.163 (s). 11 q(s)