-->
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: HibernateSession HowToUseWith HttpSessions
PostPosted: Sat Jul 23, 2005 1:37 pm 
Newbie

Joined: Mon May 16, 2005 11:55 am
Posts: 11
Hibernate version: 2.1.6
Tomcat version: 4.1
Browser for testing: Mozilla Firefox 1.0.4

Hi all!
I'm using JSF with Hibernate persistence. My application uses JavaBeans to compute the business logic and Hibernate sessions to store and retrieve informations.
Now I'm building the application with a doubt. I'm doubtful because I'm open and close Hibernate Session every request. I'm not sure that this is the best method to use hibernate sessions. Can I open and close hibernate session like the http session? how can I close hibernate session when user go away? I'm not sure of my use of Hibernate sessions.

And a second question... Have I to use versioning because it is a multiuser accessible application? and where can I understand what versioning is and how must be used?

thanx in advance...

cloud


Top
 Profile  
 
 Post subject: Re: HibernateSession HowToUseWith HttpSessions
PostPosted: Sat Jul 23, 2005 2:07 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
czanon wrote:
Hibernate version: 2.1.6
Tomcat version: 4.1
Browser for testing: Mozilla Firefox 1.0.4

Hi all!
I'm using JSF with Hibernate persistence. My application uses JavaBeans to compute the business logic and Hibernate sessions to store and retrieve informations.
Now I'm building the application with a doubt. I'm doubtful because I'm open and close Hibernate Session every request. I'm not sure that this is the best method to use hibernate sessions. Can I open and close hibernate session like the http session? how can I close hibernate session when user go away? I'm not sure of my use of Hibernate sessions.

And a second question... Have I to use versioning because it is a multiuser accessible application? and where can I understand what versioning is and how must be used?

thanx in advance...

cloud


If you're just starting to use Hibernate, I'd recommend using version 3. As for understanding how to use it with a web application and use versioning, read the reference document. It's quite complete and easy to understand.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 9:04 am 
Newbie

Joined: Mon May 16, 2005 11:55 am
Posts: 11
Quote:
If you're just starting to use Hibernate, I'd recommend using version 3.

I'm using Hibernate version 2 because the project have already started. I have to integrate the standalone part of it with a web interface.
Quote:
As for understanding how to use it with a web application and use versioning, read the reference document. It's quite complete and easy to understand.

But after reading tutorial of version2 I don't understand so much how I must use versioning and what are advantages using it or disadvantages not using it.
And for Hibernate Session I don't understand how could I open and close it. I don't understand if is better an open and a close for each httprequest or for each httpsession. And if the latter is better, where I have to write session.close() code? ...because the user could go away without telling me (the web server).

Probably my questions are stupid questions... in this case I'd like to found a place where read about this problems or understand reading another response.

If you can, help me. thanx...
cloud


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 9:18 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Close session at the end of httprequest and do not use versioning if you can live without it and do not want to have problems.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 9:18 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
czanon wrote:
Quote:
If you're just starting to use Hibernate, I'd recommend using version 3.

I'm using Hibernate version 2 because the project have already started. I have to integrate the standalone part of it with a web interface.
Quote:
As for understanding how to use it with a web application and use versioning, read the reference document. It's quite complete and easy to understand.

But after reading tutorial of version2 I don't understand so much how I must use versioning and what are advantages using it or disadvantages not using it.
And for Hibernate Session I don't understand how could I open and close it. I don't understand if is better an open and a close for each httprequest or for each httpsession. And if the latter is better, where I have to write session.close() code? ...because the user could go away without telling me (the web server).

Probably my questions are stupid questions... in this case I'd like to found a place where read about this problems or understand reading another response.

If you can, help me. thanx...
cloud



This document gives a good example of how to handle your session within a web application.
http://www.hibernate.org/43.html

As for versioning, the purpose, as well stated in the documentation, is to allow you to use an optimistic locking strategy. This will ensure that a person who is updating data in 1 browser doesn't overwrite changes made by another user/browser.


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.