-->
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.  [ 5 posts ] 
Author Message
 Post subject: Asynchronous Querys
PostPosted: Mon Aug 13, 2007 8:30 am 
Newbie

Joined: Wed Sep 27, 2006 2:54 pm
Posts: 15
Hibernate version: 1.2.0.4000

hi,
as you all know Nhibernate works in the main application Thread. just want to know if there is any option or trick that Nhibernate can do their DataBase Related Works in another thread ??!

because my DB is so large , and when NHibernate goes to run a query , the UI would be freezed for some seconds.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 13, 2007 9:34 am 
Newbie

Joined: Tue Jul 17, 2007 9:11 am
Posts: 5
Hi,

If you are in a WinForm app, you can use System.ComponentModel.BackgroundWorker, which run a "long process" in a separate thread.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 13, 2007 6:17 pm 
Newbie

Joined: Tue Sep 26, 2006 10:59 am
Posts: 15
Hello, I think the best solution is a progress bar :-)
In theory, you may try to load data to NHibernate session in a separate thread. NHibernate use Hashtable to keep all loaded objects and Hashtable is thread safe for multi-thread use when only one of the threads perform write. So if you ensure that your main thread will only read ...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 25, 2007 9:51 am 
Newbie

Joined: Wed Sep 27, 2006 2:54 pm
Posts: 15
the main problem is that my nhibernate is working on the UI thread.
if i want to use backgroundworker for nhibernate , how can i do it ?
which object i should put in it ?
is there any sample code ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 11, 2007 10:55 am 
Newbie

Joined: Tue Jul 17, 2007 9:11 am
Posts: 5
Have a look to msdn for samples on BackGroundWorker.


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