代码判断,动态的选择配置文件用spring的话,就是applicationContext.xml。
ApplicationContext ctx = new FileSystemXmlApplicationContext(XXXX/applicationContext.xml); // Spring的配置文件地址hibernate的话,就是hibernate.cfg.xml
HibernateSessionFactory中的:private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";

解决方案 »

  1.   

    <session-factory>
    private   static   String   CONFIG_FILE_LOCATION   =   "/hibernate.cfg.xml";
    <property name="connection.username">root</property>
    <property name="connection.password">*</property>
    <property name="connection.url">jdbc:mysql://localhost:</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="myeclipse.connection.profile">*</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    </session-factory>这是我的hibernate.cfg.xml 语句,请问如何操作