Hibernate 最简单例子 (4)

    publicstaticvoid rebuildSessionFactory() {

       try {

           configuration.configure(configFile);

           sessionFactory = configuration.buildSessionFactory();

       } catch (Exception e) {

           System.err

                  .println("%%%% Error Creating SessionFactory %%%%");

           e.printStackTrace();

       }

    }

 

    /**

     *  Closethesinglehibernatesessioninstance.

     *

     *  @throwsHibernateException

     */

    publicstaticvoid closeSession() throws HibernateException {

        Session session = (Session) threadLocal.get();

        threadLocal.set(null);

 

        if (session != null) {

            session.close();

        }

    }

 

    /**

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzjzyw.html