天天看點

hibernate 程式運作時的錯誤,及解決辦法(不定期更新)

hibernate 程式運作時的錯誤,及解決辦法(不定期更新)

這個錯誤是因為:沒有配置hibernate.cfg.xml中的最後一項 <mapping resource="org/hibernate/first/model/Student.hbm.xml"/>

hibernate 程式運作時的錯誤,及解決辦法(不定期更新)

這個錯誤是因為:

在配置hibernate緩存的時候出的錯,我就把我這個緩存代碼删除掉了。代碼如下

<prop key="hibernate.cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</prop>

hibernate 程式運作時的錯誤,及解決辦法(不定期更新)

這個錯誤超級低級:資料庫方言裡面應該是:MySQLDialect 千萬不要寫成其他的,比如,MYSQL什麼的。

打開hibernate.cfg.xml檔案是遇到如下錯誤的時候:

hibernate 程式運作時的錯誤,及解決辦法(不定期更新)

解決方法就是:

項目名上右鍵--〉myeclipse-->add hibernate capabilites -->next-->hibernate config file --> existing --> end  

其中,在hibernate config file的地方,應該選擇你項目裡面的 src/hibernate.cfg.xml檔案,然後next 然後,不要new 一個什麼SessionFactory類就直接finish就ok了。

hibernate 程式運作時的錯誤,及解決辦法(不定期更新)