Configurationconfiguration=newConfiguration().configure(); SessionFactorysessionFactory=configuration.buildSessionFactory(); Sessionsession=sessionFactory.openSession(); 或者通过MyEclipse的Hibernate工具自动生成的HibernateSessionFactory.getSession()方法来获取Session,调用HibernateSessionFactory.closeSessio