-->
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.  [ 7 posts ] 
Author Message
 Post subject: Intermittent errors
PostPosted: Tue Jun 20, 2006 4:30 am 
Beginner
Beginner

Joined: Wed May 31, 2006 9:24 am
Posts: 22
Hi, I am using NHibernate in an ASP.Net 1.1 App. Mostly, everything is fine, but I am getting intermittent errors as shown below. The entity class does exist, as for the most part the code is fine. I cannot replicate the error on my development machine, or on the production server, but I am consistently getting 1-2 errors of this type (and related errors) per day.

I am a little concerned as the site has only gone live for internal testing at the moment, and when released to the public will be subject to much greater load.

If anyone has any suggestions for investigating / resolving this problem I would greatly appreciate it!

Thanks, Ben :)

Hibernate version:
1.0.2.0

Full stack trace of any exception that occurs:
NHibernate.MappingException: Unknown entity class:
className
at NHibernate.Impl.SessionFactoryImpl.GetPersister(Type theClass)
at NHibernate.Impl.SessionImpl.GetClassPersister(Type theClass)
at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id,
Boolean checkDeleted, Boolean allowProxyCreation)
at NHibernate.Impl.SessionImpl.Load(Type clazz, Object id)

Name and version of the database you are using:
MS SQL 2K


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 5:12 am 
Beginner
Beginner

Joined: Wed May 31, 2006 9:24 am
Posts: 22
Hi, is there some reason no-one has replied to this? Apologies if I missed any required info, I am an NHibernate newbie... If there is some missing info that is crucial to helping me with this problem please let me know and I will do my best to provide it...

I really need some help with this as I am very concerned about scalability when this problem exists.

Cheers, Ben


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 6:27 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Looks like a threading issue. How do you configure the session factory? Please show the code.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 23, 2006 7:08 am 
Beginner
Beginner

Joined: Wed May 31, 2006 9:24 am
Posts: 22
Hi, I have 3 classes concerned with session setup, but the gist of it is this:

Code:
configuration = new NHibernate.Cfg.Configuration();
configuration.AddAssembly(this.GetType().Assembly);
nhibernateFactory = configuration.BuildSessionFactory();

if (activeSession == null || !activeSession.IsOpen)
{
   activeSession = nhibernateFactory.OpenSession();
   activeSession.FlushMode = FlushMode.Auto;
}
else
   throw new InvalidOperationException("The repository already has an open session.");


This all takes place in a Repository class, which is then placed in the HttpContext for use.

If you need the 3 classes seperately I can provide.

Cheers, Ben


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 27, 2006 5:12 am 
Beginner
Beginner

Joined: Wed May 31, 2006 9:24 am
Posts: 22
Any thoughts? Should I rework the code I use to setup the session factory, or do you need my classes to diagnose more? I'm very worried if this is a threading issue, I need to get it sorted ASAP.

Many thanks, Ben


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 27, 2006 11:41 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Is this Repository class a Singleton pattern or does it have any static properties? If so, see this thread: http://forum.hibernate.org/viewtopic.php?t=951984


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 27, 2006 12:01 pm 
Beginner
Beginner

Joined: Wed May 31, 2006 9:24 am
Posts: 22
Hi there, thanks for the response.

I have decided to implement the session manager in the project at
http://www.codeproject.com/aspnet/NHibernateBestPractices.asp

This is a singleton pattern - fingers crossed it solves the problem! I will report back after it's been tested and uploaded to the production server.

Cheers, Ben


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.