请问语句一是否与语句2相等? Session session1 = HibernateSessionFactoryUtil.getSessionFactory().getCurrentSession();
Session session2 = HibernateSessionFactoryUtil.getSessionFactory().getCurrentSession(); 语句2
SessionFactory sessionFactory = HibernateSessionFactoryUtil.getSessionFactory();
Session session1 = sessionFactory.getCurrentSession();
Session session2 = sessionFactory.getCurrentSession();
Session session2 = HibernateSessionFactoryUtil.getSessionFactory().getCurrentSession(); 语句2
SessionFactory sessionFactory = HibernateSessionFactoryUtil.getSessionFactory();
Session session1 = sessionFactory.getCurrentSession();
Session session2 = sessionFactory.getCurrentSession();
1两次去获取SessionFactory。