hibernate的一些常見的錯誤

來源:互聯網
上載者:User

No row with the given identifier exists 

表示你現在查詢的對象所關聯的對象有問題,一般是因為資料的問題(該對象所關聯的對象找不到) 

Caused by: org.dom4j.DocumentException: Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence. 
如果出現這行錯誤說明你的xml設定檔有不規範的字元,檢查下。 

net.sf.hibernate.MappingException: Error reading resource: hibernate/Hello_Bean.hbm.xml 
如果出現這行錯誤說明你的hibernate的XML設定檔有錯 

net.sf.hibernate.MappingException: Resource: hibernate/Hello_Bean.hbm.xml not found 
如果出現這行錯誤說明hibernate的XML設定檔沒有找到,你應該把XML檔案放在與你的類檔案同個目錄下,本文中是放在hibernateclasseshibernate目錄下,也就是跟Hello_Bean.class類檔案一起。 

net.sf.hibernate.PropertyNotFoundException: Could not find a setter for property name in class hibernate.Hello_Bean 
如果出現這行錯誤說明你的xml檔案裡設定的欄位名name的值與Hello_Bean.java類裡的getXXX或setXXX方法不一致。 

net.sf.hibernate.HibernateException: JDBC Driver class not found: org.gjt.mm.mysql.Driver 
如果出現這行錯誤說明你的MYSQL驅動沒有加進JB庫裡或者不在CLASSPATH裡。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.