hibernate錯誤

錯誤1.

Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/workspace/MLDN2/WebRoot/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
把hibernate裏的ehcache.xml拷貝到src目錄下,hibernate3用到了ehcache

 

錯誤2.

在使用hql進行操作的時候,表名要和類名一致,否則會出現table is not mapping的錯誤

錯誤3.

database product name cannot be null 是因爲在得到config的時候沒有在後面加.config()造成的
Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update   因爲Hibernate Tools(或者Eclipse本身的Database Explorer)生成*.hbn.xml工具中包含有catalog="***"(*表示數據庫名稱)這樣的屬性,將該屬性刪除就可以了
使用hql語句的時候,在select n.content from Newsvo  n where n.id=?的問號的位置是從0開始記數的.

錯誤4.

在使用Hibernate中,is not mapped 是hql語句中的表名首字母要大寫
No value specified for parameter錯誤的原因少了pstmt.setInt(1, id);

錯誤5.

用hibernate自動生成的save方法,進行保存的時候,報了org.hibernate.exception.SQLGrammarException: could not insert table: 發現是因爲表中創建了與關鍵字相同的字段group,修改之後就可以進行插入操作

發佈了108 篇原創文章 · 獲贊 22 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章