-->
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.  [ 3 posts ] 
Author Message
 Post subject: Session-per-Conversation flush frequency
PostPosted: Fri Apr 15, 2011 12:33 pm 
Newbie

Joined: Fri Apr 15, 2011 12:23 pm
Posts: 2
Hi!
I am currently trying to implement the Session per Conversation pattern using a "Long Conversation".
It's for a webapplication and thus I start the hibernate session after the login and flush and close the session on logout.
I do not want the sessions to become too big and also want to notify the user about possible changes that have been made by other users.
Therefore I'd like to flush the session not just at the end of the conversation but also at some points in between.
Every article that I've read about the Session-per-Conversation pattern implemented with Hibernate suggests that the flush is done in the end of the conversation.
Unfortunately they never explain why the flush is only done in the end.

Is there any specific reason to not flush in between?
Can anything go wrong regarding the data consistency if I flush during the conversation at some points?

Thanks in advance,

best regards,

Steve


Top
 Profile  
 
 Post subject: Re: Session-per-Conversation flush frequency
PostPosted: Fri Apr 15, 2011 4:39 pm 
Newbie

Joined: Tue Sep 14, 2010 4:29 pm
Posts: 16
Hi StevePech,
I think you're stretching the Conversation pattern a bit too far. A Hibernate Session should still be a not too long living thing. The Conversation pattern is intended for wizard style work flows, where you lead your user through several steps and store his input at the end of the wizard. That's the reason why the tutorials flush at the end of the conversation.
Cheers ngomo

_________________
http://www.winfonet.eu


Top
 Profile  
 
 Post subject: Re: Session-per-Conversation flush frequency
PostPosted: Fri Apr 15, 2011 6:27 pm 
Newbie

Joined: Fri Apr 15, 2011 12:23 pm
Posts: 2
Hi and thank you for the reply!
Are you sure about the duration of the conversation?
I've read some articles on the session-per-conversation pattern with hibernate and one explicitly speaks about multiple input masks in an application.
It says that one way to implement the pattern was to open a session at the login and use it for all the different input masks an application requires.
Finally close it at the logout, just like I do it.
Unfortunately it's in German (http://www.ordix.de/ORDIXNews/2_2007/Ja ... ation.html).

What would be the drawback if I kept the session open over the whole time between login and logout?
To my understanding, the session serves as some kind of cache.
So the longer it is open, the higher is the probability that the cache gets old.
For applications with only few users this should be fine, expecially if I regularly do a session.flush in order to persist the data to the database.
Are there any other specific reasons for not keeping a session open for such a long time?

Greetings,
Steve


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