Re: Hibernate + Tomcat - where to bind the session to?



Get the book Hibernate in Action, by Christian Bauer and Gavin King.
It's well worth it. It covers this question, and everything else.

voigt@xxxxxxxx writes:

> Hello group,
>
> I am building a web application with Tomcat and Hibernate as O/R
> mapper. Now my question is where should I bind the session to?
>
> At the moment I have the Hibernate Session as a ThreadLocal, so for
> each thread a new HibernateSession is created. Another possibility
> would be to bind the hibernateSession to the httpSession, so each user
> has his/her own Hibernate session. Does this make sense? How much mem
> would this take up per user? Perhaps it makes it easy to DOS the
> server?
>
> Another thing which is related to the above thoughts: is it OK to
> store a persistent object in the HTTPSession temporarily for some
> time? What if hibernateSession from thread A fetches the object,
> thread B changes it and thread C calls saveOrUpdate() ? Will this
> break my app or will it work?
>
> I am a bit confused about this and looking forward to your answers :)
>
> Greetings
> Bastian Vogit
.



Relevant Pages

  • Re: Hibernate + Tomcat - where to bind the session to?
    ... with or without hibernate a transaction must not last longer than ... a user transaction and so I would not store a hibernate session in the ... > would be to bind the hibernateSession to the httpSession, ...
    (comp.lang.java.databases)
  • Hibernate + Tomcat - where to bind the session to?
    ... I am building a web application with Tomcat and Hibernate as O/R ... Now my question is where should I bind the session to? ... store a persistent object in the HTTPSession temporarily for some ...
    (comp.lang.java.databases)
  • bind my hibernate key to some command?
    ... running a debian 2.6.18 kernel on a mostly-ubuntu edgy system, ... to find a way to bind the "hibernate" key on my laptop to some function. ...
    (Debian-User)
  • bind my hibernate key to some command?
    ... running a debian 2.6.18 kernel on a mostly-ubuntu edgy system, ... to find a way to bind the "hibernate" key on my laptop to some function. ...
    (Ubuntu)