-->
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: Just one session ?
PostPosted: Thu Dec 11, 2003 7:24 am 
Newbie

Joined: Wed Dec 10, 2003 3:44 pm
Posts: 12
Is it a viable solution for a standalone Swing application to have just one session for the whole application ?
If yes, better static or singleton ?

Isn't there any risk that the (single) session gets closed against my will ?

Should I use new 2.1rc1 session.connect() and disconnect() methods ?

Thanks for your attention!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 7:40 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Only 1 user is using your app ?

The session won't be closed, the SQL connection might.

1 user: You might face OutOfMemoryException if you deals with lot's of objects (use session.clear() soemtimes to avoid this)
several users: You might fail into dirty data issues. Session is intended to keep updodate data.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 8:34 am 
Newbie

Joined: Wed Dec 10, 2003 3:44 pm
Posts: 12
No, many users will use each their own Swing application. Then do you think it's a bad solution ?

I still don't understand if using a single session is a smart choice or not.

Thanks for your attention!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 9:57 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Bad solution.
Keeping the session opened (neither disconnected or closed) implies that your have 1 dB connection for each user. Might be a problem or not, check your DBA.

1 long running session keep data. data become stale when other users play with. => you'll have lot's of concurrent errors (1 user use an old reading of A which has been updated by another).

Try to use session for each 'user transaction', it'll be fine

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 10:12 am 
Newbie

Joined: Wed Dec 10, 2003 3:44 pm
Posts: 12
Ok. Thanks a lot Emmanuel !


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.