openSession « Session « JPA Q&A





1. Using openSession() over getCurrentSession() - when and why?    stackoverflow.com

This question is in relation to another question I have asked, but what are the reasons as to why you would use openSession() over getCurrentSession()? I know you would ...

2. difference between sessionfactory.openSession() and sessionfactory.openStatelessSession()?    stackoverflow.com

I want to know the conceptual difference between the above mentioned two methods of the hibernates sessionfactory class if poosible with simple example.

3. GetCurrentSession VS OpenSession in Hibernate    forum.hibernate.org

4. Does openSession return same session within a single tx?    forum.hibernate.org

All-- First some background: I'm currently using CMT where the session bean that opens the session and stores it in thread local storage, invokes a method (eg. createUser) on a DAO, rolls back the transaction if necessary and closes the session. I've also developed a DAOthat gets the current session from thread local storage, calls the appropriate method on the session ...

5. sessionFactory.openSession() call failed    forum.hibernate.org

Newbie Joined: Mon Feb 21, 2005 3:49 am Posts: 15 Dear All have problems to invoke sessionFactory.openSession() I am run Tomcat Project on Debian Linux, JDK1.5.0.03, Struts 1.2.4, Hibernate 2.1.8, MySQL 4.1.11, Tomcat 5.0.28 any help are great appreciated max Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 2.1.8 Mapping documents:

6. openSession vs getCurrentSession    forum.hibernate.org

The following is basic structure of my transactions using hibernate. Code: public void createUser(User user) throws HibernateException, LogConfigurationException { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); Log log = LogFactory.getLog(Log4JLogger.class); try ...

7. Getting NPE between openSession() and getCurrentSession()    forum.hibernate.org

Hi, I am a newbie to Hibernate, I have a ServletFilter to do the Transactions, but whenever i call openSession followed by sf.getCurrentSession() i get the NullPointerException. public class ServletManagerFilter implements Filter{ private SessionFactory sf; ... public void init(FilterConfig arg0) throws ServletException { log.debug("Initializing filter, obtaining Hibernate SessionFactory from HibernateUtil"); sf = HibernateUtil.getSessionFactory(); } /* (non-Javadoc) * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) ...

9. Nullpointer on SessionFactory openSession    forum.hibernate.org

I searched the forums and I couldn't find anything which quite matched my problem. I am making my initial pass at integrating Hibernate. This code is more of a demo, trying to do a proof of concept. The following code is generating a null pointer when I try to open a session connecting to an Oracle 10g DB and Hibernate 2.1. ...





10. openSession() or getCurrentSession()?    forum.hibernate.org

public class HibernateUtil { private static final SessionFactory sessionFactory; static { try { // Create the SessionFactory from hibernate.cfg.xml sessionFactory = ...

13. openSession() vs getCurrentSession()    forum.hibernate.org

Sorry if I say something too obvious. openSession retrieves a newly created sesion, while getCurrentSession gets the last sesion created with openSession (if you didn't close it). The second is a cheaper option, as it reuses the session (The session stores in session cache all objects used, so that less database access are required if you access the same object twice ...

14. diff between openSession and getCurrentSession    forum.hibernate.org