-->
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: NHibernate sessions and threads
PostPosted: Mon Nov 27, 2006 5:25 am 
Beginner
Beginner

Joined: Wed Nov 22, 2006 5:59 am
Posts: 29
Location: London
I am having trouble with NHibernate sessions and threads. I have a class that creates a new thread which polls a database every 5 seconds. The problem I'm having is that when the thread calls the code to open a new session. I get the following error:

Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905"

If i don't use threads the code works fine but as soon as I try to use a seperate thread I get this error. I have log4net referenced etc. Here is the code I'm using to initialize my session factory etc:

Code:

     public sealed class NHibernateHelper
    {
        private static readonly ISessionFactory sessionFactory;

       
        static NHibernateHelper()
        {
            sessionFactory = new    Configuration().Configure().BuildSessionFactory();
        }
       
        public static ISession GetNewSession()
        {
            return sessionFactory.OpenSession();
        }
       
       public static ISessionFactory SessionFactory()
       {
           return sessionFactory;
       }
    }
[/b]


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