Hibernate 最简单例子 (5)

     *  returnsessionfactory

     *

     */

    publicstatic org.hibernate.SessionFactory getSessionFactory() {

       returnsessionFactory;

    }

 

    /**

     *  returnsessionfactory

     *

     *  sessionfactorywillberebuildedinthenextcall

     */

    publicstaticvoid setConfigFile(String configFile) {

       HibernateSessionFactory.configFile = configFile;

       sessionFactory = null;

    }

 

    /**

     *  returnhibernateconfiguration

     *

     */

    publicstatic Configuration getConfiguration() {

       returnconfiguration;

    }

 

}

 

2User.hbm.xml

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<!--

    Mapping file autogenerated by MyEclipse Persistence Tools

-->

<hibernate-mapping>

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

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