Thanks, sounds promising.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Herman Lintvelt
Sent: 02 June 2006 01:42 PM
To: [email protected]
Subject: [CTJUG Forum] Re: Another Swing and Hibernate issue


Hi Enrico.

Try and keep any DAO code out of the event thread (this will make your 
GUI unresponsive, as long operations being executed by the event thread 
stops any repainting, etc from happening).

What you could do is make use of a background thread that gets tasks to 
execute from a blocking queue. This thread keeps the Hibernate session, 
and can do the DAO work. You feed DAO tasks to this thread via the queue 
from any other thread (similar to how the event thread works). Look at 
the java.util.concurrency package.

Cheers,
Herman

Enrico Goosen wrote:
>
> Hi All,
>
> I'm writing a second Swing application, and this time around I'm using 
> an existing Hibernate middletier.
>
> The problem I'm experiencing is that the HibernateUtil stores a 
> Hibernate Session per ThreadLocal, which is posing a problem for my 
> application.
>
> It appears that 2 Hibernate sessions are being created, one for the 
> main thread and one for the event-dispatching thread.
>
> I'm not sure how to prevent my DAO code from running on the 
> event-dispatching thread.
>
> Or, how do I force my DAO code to run on the main thread?
>
> Any suggestions?
>
> Enrico Goosen
>
> Software Developer
>
> SAICOM TECHNOLOGY
>
> TEL: +2721 417 1375
>
> FAX: +2721 417 1361
>
> CEL: +2783 305 5676
>
> EMAIL: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>
> >
>
> __________ NOD32 1.1575 (20060602) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>

-- 

---------------------------------------------------
Herman Lintvelt                 Polymorph Systems

Mobile: +27-82-339-6932
Web:    http://www.polymorph.co.za
Skype:  hermanlintveltza
---------------------------------------------------




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CTJUG Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Forum
For the ctjug home page see http://www.ctjug.org.za
-~----------~----~----~----~------~----~------~--~---

Reply via email to