web « Session « JPA Q&A





1. getCurrentSession hibernate in web    stackoverflow.com

I am writing a web based application with hibernate and jsp/servlet. I have read about the sessionFactory.getCurrentSession and sessionFactory.openSession methods. I know the basic difference between them (using getCurrentSession you don't ...

2. Does it really matter to use diffrent hibernate session for one web app thread ?    coderanch.com

When we use web application to call hibernate code to retrieve some object like user profile, then user can edit it and then our code can sync it back to database using hibernate. Procedure like -- Profile myPro = ProfileDAO.get(..) // line 1 myPro.set(..); myPro.set(..); profileDAO.update(myPro); // line 3 so if in the ProfileDAO class we have public get(..) { try ...

3. Web App hangs up when opening hibernate session factory    coderanch.com

Hello All, I have a very strange problem that causes our web application to hangup. I'm using the following technologies Spring 2.5.6 Spring Security 2.0.1 Spring Security 2.0.1 core-tiger Hibernate 3.0 JDK 1.6 update 10 PostgreSQL 8.3 (postgresql-8.3-603.jdbc3 driver) I have a Class Campaign having a many-to-many association with Two other Classes namely Location and Advertisement. A Campaign can be run ...

4. One webapp with multiple databases (and session factories)    forum.hibernate.org

We have a requirement that is really begging that each customer have it's own database. All the databases will have an identical schema. We would, of course, need to have a session factory configured for each database. However, there could be upward of 100 separate databases. Ideally, having all 100 session factories build on system startup makes things easy programatically. However, ...

5. Hibernate in Java web - Sessions doubt    forum.hibernate.org

Hi everyone! I'm new in Hibernate, and I have a question about Java Web and Hibernate usage. I'm writing a web application which will be used by more than 20 people at a time. This means, that more than one user might be using the same feature of the application, and saving the same entity at the same time. For example: ...

6. using SessionFactory from a HAR from a webapp.    forum.hibernate.org

Beginner Joined: Mon Sep 08, 2003 10:56 am Posts: 35 Okay so I read the other thread about "the best way to access hibernate data" and have now incorporated the UserTransaction code into the servlet I'm trying to access this from: Code: UserTransaction transaction = (UserTransaction)(newInitialContext()).lookup("java:/UserTransaction"); transaction.begin(); Session sess = HibernateContext.getSession(DBO_SESSION); ...

7. Session handling in web applications    forum.hibernate.org

I'm just wondeing how you're handling sessions and its JDBC connection in web applications. Is there any common way, or are you just creating session in SessionListener and closing and opening it JDBC connection on filter or RequestListener? If I have understood correctly, lazy initialization work correctly if user have same session object available all the time....so you cannot create new ...

8. Best Way to deal with SessionFactory in Web App    forum.hibernate.org

We all know that open a sessionFactory and reading a property file or hibernate.cfg.xml takes time. This should not be done for each query/update request coming from the web client. But what is the best way to do it? At webserver startup time and then cache it? Any suggestions would be highly appreciated.

9. web application and hibernate session handling    forum.hibernate.org

Having read the document over layered architecture and session handling, I am still quite unsure how to use Hibernate in my web application. At the moment I disconnect the session which has the effect that I am having a new session for each web request. I expect to get memory problems under traffic, when I do not properly close the session. ...





10. Web application session handling    forum.hibernate.org

I have run into a rather tricky session problem (or so I think :) )... To explain my setting I have a webapplication (running in WebLogic) having a rather large persisted object graph. So one of my wishes are to do lazy collections etc. We have implemented the SessionFilter approach describe in the "Hibernate in Action" book, and 90% of the ...

11. Dealing with Session thread-unsafety in web apps, HIA p.328    forum.hibernate.org

Hibernate version: 2.1* Hello, I have a webapp that uses Hibernate, and I'm considering saving Hibernate Session in HttpSession, so I can benefit from the Session acting as a second level cache and thus avoid a few DB hits. Unfortunately, Session is not thread-safe, so a user hitting my webapp with multiple parallel requests (e.g. quickly opening multiple pages in new ...

12. How to get another web app's SessionFactory?    forum.hibernate.org

there are multiple scopes in Tomcat's JNDI tree (IIRC). There are app specific resources, and there are global resources. Global resources are available for lookup by all apps. Did you try making both session factories available in the global context? This should allow you to look up both of them from either app.

13. Best practice for Hibernate session handling in AJAX Web app    forum.hibernate.org

Newbie Joined: Sun Feb 05, 2006 6:24 pm Posts: 7 I'm working on a Hibernate integration in ZK zk1.sourceforge.net... I have used an approach described in Enjoying Web Development with Tapestry some basic assumptions... not realy shure... *a Hibernate session is an expensive ressource... create it only when necessary, dont hold it after a response is sent to the client! *a ...

14. Session.flush() before web response rendering...    forum.hibernate.org

How safe do you think I would be by not doing a commit() before rendering my response, but just doing a flush()? The idea is that we don't want the response to be written back to the browser and then at the end of it all, we try to commit and something goes wrong. Would flush do most all of the ...

15. the proper place to open and close sessions in web app    forum.hibernate.org

Newbie Joined: Thu Mar 17, 2005 5:50 am Posts: 12 Hello All, I have a web project that use servlets struts hibernate DAOs I want to know where is the proper place to handle the session opening and closing servlets , or struts action or DAOS or where exactly I use this hibernate session factory Code: import java.util.Date; import org.hibernate.HibernateException; import ...

16. SessionFactory.close() - where/how to call this from webapp?    forum.hibernate.org

Just thought I'd post the solution to this question... came upon the solution from a former colleague... You need to create a class that implements the ServletContextListener interface. It will require you to implement 2 methods - one for when the context is created, and one when it is destroyed. You then add this class in your web.xml as a listener... ...





17. Web App hangs up when opening hibernate session factory    forum.hibernate.org

Author Message hkhan45 Post subject: Web App hangs up when opening hibernate session factory Posted: Thu Jun 25, 2009 1:16 am Newbie Joined: Thu Jun 25, 2009 1:14 am Posts: 1 Hello All, I have a very strange problem that causes our web application to hangup. I'm using the following technologies Spring 2.5.6 Spring Security 2.0.1 Spring Security 2.0.1 ...