這個錯誤是因爲:沒有配置hibernate.cfg.xml中的最後一項 <mapping resource="org/hibernate/first/model/Student.hbm.xml"/>
這個錯誤是因爲:
在配置hibernate緩存的時候出的錯,我就把我這個緩存代碼刪除掉了。代碼如下
<prop key="hibernate.cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</prop>
這個錯誤超級低級:數據庫方言裏面應該是:MySQLDialect 千萬不要寫成其他的,比如,MYSQL什麼的。
打開hibernate.cfg.xml文件是遇到如下錯誤的時候:
解決方法就是:
項目名上右鍵--〉myeclipse-->add hibernate capabilites -->next-->hibernate config file --> existing --> end
其中,在hibernate config file的地方,應該選擇你項目裏面的 src/hibernate.cfg.xml文件,然後next 然後,不要new 一個什麼SessionFactory類就直接finish就ok了。
出現這個問題的原因,可能是因爲你的數據庫裏面沒有對應的表。