乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      No CurrentSessionContext configured!" 異常解決方案 - esffor - JavaEye技術(shù)網(wǎng)站

       ShangShujie 2010-04-19

      hibernate 老說沒有配方言

      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      這 句話明明就寫在了配置文件里面,可老是沒有寫
      錯誤如下:
      Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

      name 改成"hibernate.dialect"也不行

      Hibernate-Version: 3.1.1
      mysql -Verison: 4.0.16


      用這種方法正確
      static {

      try {
      configuration = new Configuration();

      sessionFactory = configuration.configure().buildSessionFactory();
      } catch (Throwable ex) {

       

      throw new ExceptionInInitializerError(ex);
      }
      }

      這 種方式會出現(xiàn)異常
      // static {
      // try {
      // // Create a configuration based on the properties file we've put
      // Configuration config = new Configuration();
      // config.addClass(Customer.class).addClass(Order.class);
      // // Get the session factory we can use for persistence
      // sessionFactory = config.buildSessionFactory();
      // } catch (Exception e) {
      // e.printStackTrace();
      // }
      // }

      第二種方式是針對使用properties文件配置 hiernate的寫法,使用hibernate.cfg.xml應使用第一種調(diào)用方式

      或 者在hibernate.cfg.xml中加入:

       

      <property name="current_session_context_class">thread</property>

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多