-->
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: Hibernate Sessions in a vanilla Tomcat/Jetty servlet
PostPosted: Fri Jul 09, 2010 11:44 am 
Newbie

Joined: Fri Jul 09, 2010 11:08 am
Posts: 2
Hi,

What is the best way to manage sessions when using Hibernate inside a plain java servlet.
My application is a simple GWT application using Hibernate to access and persist data.

2 approaches I have found so far include

1. Create a ThreadLocal<Session> and open and store the session in it.
Use the Session object for subsequent calls.
Question..
- Do I need to call Session.Close ? If I do, where in my code do I call Session.close() ?

2. Open a Session when a HTTP GWT/POST request and close it after the page has been rendered.
Question..
- What is the overhead involved in SessionFactory.openSession ?

What other means do I have at my disposal to manage sessions ?

Regards,


Top
 Profile  
 
 Post subject: Re: Hibernate Sessions in a vanilla Tomcat/Jetty servlet
PostPosted: Wed Jul 14, 2010 12:33 pm 
Newbie

Joined: Fri Jul 09, 2010 11:08 am
Posts: 2
Dont bother to reply.

After researching this forum and many others I realized my mistake.
Posting my reply for others benefit.

ORM is good, but Hibernate takes it to such an extreme that it could be be called insane.
I chose MyBatis, coz its light, flexible and predictable.

For Noobs or people who are evaluating, I would recommend looking at MytBatis before they decide on Hibernate.

Good luck Hibernate, I hope you die soon.
You suck !!!


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.