-->
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.  [ 2 posts ] 
Author Message
 Post subject: Proper Use of Session?
PostPosted: Tue Sep 27, 2005 7:31 pm 
Newbie

Joined: Tue Sep 27, 2005 7:28 pm
Posts: 2
Just exactly how much can you do with a Session? I'm a bit unclear on this from the documentation.

Can one Session cover just kind of query or update?
E.g SessionFactory is to Session as Connection is to Statement

I've tried to just obtain one Session in the past and use it for everything, but sooner or later I run into trouble from not flushing.

Hibernate version:
3.0


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 27, 2005 8:03 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
Different options -
One -
Use 1 session per business method that is exposed to the client.
So, for example, if the client wants to do saveOrder(), that uses one session.
If client wants to invoke updateUser(), that uses different session.
This assumes that there is a clear separation between where the client ends and server starts. This is closer to a ejb 3.0 usage pattern.

Two-
Is to use one session per thread on the server. The session is started when Get or Post on servlet is invoked. The session is closed just after the response is sent.

Which one you use depends on your situation


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