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.  [ 2 posts ] 
Author Message
 Post subject: current_session_context_class
PostPosted: Fri Dec 29, 2006 1:28 pm 
Beginner
Beginner

Joined: Thu Dec 21, 2006 11:38 am
Posts: 30
Has anybody noticed that "current_session_context_class" in nHibernate doesn't properly handle "thread"?

The problem is with the following code, which appears to want a specific class name, and not a more generic "thread" string value:
Code:
      private ICurrentSessionContext BuildCurrentSessionContext()
      {
         string impl = properties[Cfg.Environment.CurrentSessionContextClass] as string;

         if (impl == null)
         {
            return null;
         }
         try
         {
            System.Type implClass = ReflectHelper.ClassForName(impl);
            return (ICurrentSessionContext) Activator.CreateInstance(implClass, new object[]{this});
         }
         catch (Exception e)
         {
            log.Error("Unable to construct current session context [" + impl + "]", e);
            return null;
         }
      }


I did a little sleuthing and found no classes that implement ICurrentSessionContext either... am I missing something here?

Basically I'm working with an ASP.Net application, and yes, I know you could build an NHibernateUtil or NHibernateHttpModule to build a session per request, but I'm trying to keep my class library from having a dependency on System.WEb and also trying to keep the ASP.Net app from "knowing" how to configure Data access...

In a lot of hibernate documentation, this "thread" setting is the same as building a session per request, so it would be helpful to either have this work like the Java hibernate.

In all honesty, I would love to contribute some thoughts and code to the project to address this

Thanks!

E.Newton


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 29, 2006 1:54 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, current_session_context_class is not yet fully implemented and documented, so please consider it non-existent right now.


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.