-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: SessionFactory.GetCurrentSession();
PostPosted: Fri Feb 26, 2010 9:30 am 
Beginner
Beginner

Joined: Sat Jan 26, 2008 6:33 am
Posts: 24
Hi!

I am trying to figure out where a Proxy is getting the current session.
We are developing a Web-Application and after loading business objects, the session is closed.
Now when NHibernate tries to lazily load any dependent object, it of course throws an Exception, because there is no current session.
For testing I implemented a SessionContext class like this:
Code:
public class SessionContext : CurrentSessionContext
{

   public SessionContext(ISessionFactoryImplementor implementor)
   {
   }

   protected override ISession Session
   {
      get { return Database.Current.Session.Open(); }
      set { }
   }

}

But this implementation is only called, when i call SessionFactory.GetCurrentSession(); in my code. I was expecting NHibernate to use this to get its current Session. But it doesnt seem to be working like this. So, where can i hook in so NHibernate uses my implementation?

Greetings!
Zorgoban


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.