servlet « Session « JPA Q&A





1. Not able to create a hibernate session from servlets..doPost method    coderanch.com

I am trying to call a hibernate session from doPost method of the servlet ....when i debug it,to my surprise i see that when the code for hibernate session creation is encountered the whole thing blows up resulting in an exception... Please find the snippet below ----------------------------- public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { response.setContentType("text/html"); String ...

2. Hibernate session per servlet session or request    forum.hibernate.org

It seems to me there are two different ways to handle Hibernate sessions in a Servlet environment. The first one is to create a new session for every request (as in the reference documentation section 1.4). The other approach is to put the hibernate session in the servlet session, and then to reconnect and disconnect for every request (as mentioned in ...

3. Do i need to close session with a servlet filter    forum.hibernate.org

My action, get a list from a dao object. When my dao object init my list, it open a session with : getList(){ try{ ... session = HibernateFilter.getSession();. ... }catch{ ... } finally{ HibernateFilter.getSession().close(); } } Then the view is called by my action. The view display my list and the content of each object (without lazy loading : thanks the ...

5. Advice on keeping session open in servlet context    forum.hibernate.org

Hi There I've inherited an application using Hibernate 2.0 on Tomcat and MySQL for a struts-based community based website. Each Community has a Location, and each Location has a set of adjacent Locations and child Locations, like this: ...

6. Advice for Session creation/closing in servlets    forum.hibernate.org

Hibernate version: 2.1.6 Name and version of the database you are using: MySQL 4.1 w/InnoDB Hello all, I am rather new to the JBoss/Hibernate scene and have a question regarding the creation and closing of Sessions. I have been trying to figure out how the Servlet lifecycle and reuse will affect the persistance behavior if I open a Session in a ...

7. Session member variable in servlet destroys the world??    forum.hibernate.org

We had a crazy issue with connections staying open, and our solution was to move the Session variable from class scope to inside the doGet(). Nothing else was mucking with the member variable, and I can't figure out why this could be an issue. It was only a problem when the servlet was being hammered. Here is a (sample) of the ...

8. open session in view over servlets    forum.hibernate.org

I'm working with servlets and hibernate, and I would like to implement an open session in view pattern, a bit different of the normal implementation (the documentation way). What I would like to do is to keep one hibernate session per http session. When user logs, open the session, when user log out close the session. And among user calls begin ...